The size member function.
myList.size();
http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html
Answer from Adam Reed on Stack Overflowjava - How to find the length of an array list? - Stack Overflow
why in java does an array use length and an arrayList use Size?
List vs Array vs ArrayList
[Java] How to write .size() method for an ArrayList?
Videos
The size member function.
myList.size();
http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html
System.out.println(myList.size());
Since no elements are in the list
output => 0
myList.add("newString"); // use myList.add() to insert elements to the arraylist
System.out.println(myList.size());
Since one element is added to the list
output => 1
Coming from Python, this whole Java thing is incredibly confusing. The thing is, they don't seem to mix and uses different methods such as .size() vs .length(). All of them also seem to be doing the same thing: having a group of something.
I really need a comparison of the three, and how to declare, manipulate, and access, etc them.
I have an ArrayList and I need to override the .size() method to get the size. Any help would be appreciated