I have a collection object in data with data in it. How to convert Collection to Array in Java?
You can use the following code to create a collection:
List<String> myList = new ArrayList<String>(); list.add("This ");
Above code create a collection and then add an item to it.
Now to convert it into list myList.toArray() function can be used which converts Collection to Array in Java.
Here is the code for converting Collection to Array:
String s1 = myList.toArray(new String);
Check complete tutorial at Converting Collection to an Array.
Check 100s of Java Util Examples.