Adding to an ArrayList

Edit on Github instead

Use the void add(Object o) method to add an Object to an ArrayList.

For example:

ArrayList<String> myList = new ArrayList<String>();
myList.add("Hello");
myList.add("Goodbye");

produces an ArrayList called myList that looks like ["Hello", "Goodbye"]

Suggest changes

Related links

URL Topic Source