To convert an Array into a Java ArrayList we can use the java.util.Arrays class's asList() method. The following code example demonstrates converting an Array of Strings to an ArrayList of Strings.
Source Code (Pastebin)
This will print out the following to the console:
Mary
had
a
little
lamb
You can now add(), remove() etc. using the assorted methods available on ArrayLists.
Simples!
No comments:
Post a Comment