Exploring Java Collections – Understanding ArrayLists

Exploring Java Fundamentals - Understanding ArrayLists

ArrayLists are a part of the Collection Framework offered by Java as a part of the java.util package. Collections are data structures which can be used to hold a group of objects together as a single entity and perform operations on top. They are also provided with powerful and useful methods and features which can reduce the overall programming effort.

  1. ArrayList (java.util package) is Dynamic Array (Resizable-array).
  2. ArrayList implements RandomAccess interface (Marker interface) used for fast random access based on index.
  3. RandomAccess interface (Marker interface) is used in searching, add, removing object in particular index of ArrayList.
  4. ArrayList extends AbstractList class which provides implementation to List interface.

Constructors in ArrayList:

  • ArrayList(): This is default constructor of Arraylist. It will have initial capacity of size 10.
  • ArrayList(Collection c): This constructor will add existing collection object to ArrayList.
  • ArrayList(int capacity): This constructor is used to overwrite initial capacity of ArrayList.




Features of ArrayList:

  • Index based structure – ArrayList is an Index based structure in java.
  • Duplicate elements – ArrayList allows to store duplicate elements in java.
  • Null elements -Null elements can be added in ArrayList in java.
  • Insertion order – ArrayList maintains insertion order in java.
  • Asynchronous – It is not synchronized (because 2 threads on same ArrayList object can access it at same time).
  • Performance – ArrayList is not synchronized, hence its operations are faster as compared to some other synchronized implementation of List interface in java.

Buy Me A Coffee

Found this article helpful? Please consider supporting!


I'm a full-stack developer and a software enthusiast who likes to play around with cloud and tech stack out of curiosity. You can connect with me on Medium, Twitter or LinkedIn.

Leave a Reply

Your email address will not be published. Required fields are marked *