DEV Community

Discussion on: Convert ArrayList<String>() To Stirng[] Array in Android

Collapse
 
ibibgor profile image
Oscar

Isn't it more performant to use the buildin method toArray(). So the code would be:

List<String> list = new ArrayList<>();
// add some data
String[] starr = list.toArray(new String[0]);