Java: Convert ArrayList to Array.

/ Published in: Java
Save to your folder(s)

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

Copy this code and paste it in your HTML
  1. ArrayList<String> strList = new ArrayList<String>();
  2. String[] strArray = strList.toArray(new String[0]);

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.