Java Collection Framework

Iterable Interface

This is root for all the interfaces and classes. Collection interface extends iterable while all other sub classes implement iterable.

Collection Interface

The collection interface provides a base for all other classes and interfaces in collection framework except iterable.

List Interface

List interface in Java used to store the list items in forward or backward directions and do operations like insert, delete, sort, search and update.

Array List

At any time, we can add or remove elements from the Java array list. However by default, Array Lists are designed to hold 10 elements. But we can add or remove elements as our preferences. Therefore, Array List is more flexible than the using arrays in Java.

  • Array has fixed size length while the size of Array List is dynamic.
  • Array used to represent via [] while Array List represent via different methods.
  • Array is faster than using the Array List since it has fixed size length.
  • In Arrays we use for loop for iteration purpose while Array List has a method called iterator() to iterate elements.

Linked List

The Lined List is a linear data structure where store the elements not in contiguous locations. Also Linked List is the implementation of doubly linked list. Which means a node (that has element in Linked List) has a pointer to its previous and next note in the list.

  • Array List is dynamic array while Linked List is a doubly linked list.
  • Array List is slower than the Linked List since it need to shift the elements when we try to add or remove the elements.
  • Array is used for storing or accessing while Linked List useful for manipulating data.


Vector class consumes also dynamic array but synchronized. It is better to use vectors in multi threading environment. The elements in Vector can be accessed using the integer indexes. Also, Vector has its own methods than Array List which makes a different between them.


Stack class provides also a linear data structure which based on Last-In-First-Out (LIFO) order. Stack provides variety of methods like push, pop, search peek and so on.


Differ from Java Stack. Queue interface in Java Collections is based on the First-In-First-Out (FIFO) method.


Dequeue stands for Doubly-Ended Queue. Dequeue can be used with the fixed size as well non-fixed size arrays.

Array Dequeue

The elements in Array Dequeue class can be removed from both sides. Also, there should not be null elements in here. Much more faster than Stack and Linked List.

Priority Queue

Priority queue interface is used when the objects are processing by its priority. Also, it does not hold the null values.


It holds the unordered object and can not have the duplicated values as well. Basically Set Interface is used to store the mathematical values of Sets. It performs operations like intersection, union, difference and so on.

Hashed Set

This is one of the classes in Set interface which used to store the hash table in Java by using hashing. Hashed Set does not maintain an order and elements are stored by based on its hash code.

Linked Hash Set

This is a hash set with doubly-linked list.

  • The default constructor: LinkedHashSet()
  • Constructor with the element of collection: LinkedHashSet(Collection c)
  • Constructor with the size of linked hash set: LinkedHashSet(int size)
  • Constructor with capacity+load capacity: LinkedHashSet(int size, float load_capacity)

Sorted Set

Also used to store the mathematical sets but in a sorted manner.

Tree Set

Tree Set is the implementation of sorted set. And also it is non-synchronized.

  • The default constructor: TreeSet()
  • Constructor with the element of collection: TreeSet (Collection<? extends E >c)
  • Constructor with empty set which is sorted according to the constructor in future: (Comparator<? super E >Comparator)
  • Constructor with the sorted elements: TreeSet(SortedSet<E> s)

Stay Safe !!!



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Sanduni Jayaweera

Sanduni Jayaweera

Associate Software Engineer at Virtusa.