Posted By

BenClayton on 02/24/11


Tagged


Versions (?)

Java: Convert ArrayList to Array.


 / Published in: Java
 

This works for types other than string, of course. Don't try to use the .toArray() method without params and cast.

  1. ArrayList<String> strList = new ArrayList<String>();
  2. String[] strArray = strList.toArray(new String[0]);

Report this snippet  

You need to login to post a comment.