[Java] How to Cast ArrayList#toArray to String[]

Tadashi Shigeoka ·  Fri, May 31, 2013

I’ll introduce how to cast ArrayList#toArray to String[] in Java.

Java
String[] stringArray = (String[]) arraylist.toArray(new String[]{});

That’s all from the Java Gemba.

Reference Information