ArrayList
Learn ArrayList (List Interface, Collection Framework) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is an ArrayList? An ArrayList is a resizable array . A normal Java array has a fixed size that you choose once; an ArrayList starts small and grows by itself when you add more elements, and shrinks when you remove them. Think of a list of forts you want to visit: you can add a new fort at the end, insert one in the middle, or cross one off, without ever deciding the size in advance. It lives in the java.util package and implements the List interface (so it is an ordered collection). Order is kept: elements stay in the order you added them, and every element has an index starting at 0 ....