Home > DeveloperSection > Forums > How to convert an array into an arrayLists in java
Royce Roy
Royce Roy

Total Post:134

Points:938
Posted on    February-27-2015 10:52 PM

 Java Java 
Ratings:


 1 Reply(s)
 527  View(s)
Rate this:
How to convert an array into an arrayLists in java ?


Mayank Tripathi
Mayank Tripathi

Total Post:397

Points:3117
Supported
Posted on    February-27-2015 11:31 PM

Suppose u have a string array :

String[ ] names = {"Tom", "Tim", "Ben", "Jack", "Alisa", "Rose"};

We don't exactly convert this array to arraylist , but we can view and use this array as array list ,

List<String> nameList =  Arrays.asList (names);

also if you want arraylist:

ArrayList <String> nameList = new ArrayList<String> (Arrays.asList(names));

Don't want to miss updates? Please click the below button!

Follow MindStick