ArrayList size

Edit on Github instead

ArrayLists have an int size() method that returns the number of items in the list.

For example:

ArrayList<String> myList = new ArrayList<String>();
myList.add("Hello");
myList.add("Goodbye");
myList.add("Hi");
myList.size();          // returns 3

Suggest changes

Related links

URL Topic Source