loading...

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

Sandeep kamboj on July 11, 2018

ArrayList list=new ArrayList<>();
list.add("A");
list.add("B");
list.add("C");
list.add("D");

String[] stringArr=TextUtils.join(",",list).split(",");

markdown guide
 

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]);
code of conduct - report abuse