Java Collections Cheat Sheet

Below is the Java collections cheat sheet. You can use it as quick reference guide to prepare for the interviews.

Java Collections Cheat Sheet

Basics :

What is Java Collection Framework?

Java Collection Framework is a framework which provides some predefined classes and interfaces to store and manipulate the group of objects. Using Java collection framework, you can store the objects as a List or as a Set or as a Queue or as a Map and perform basic operations like adding, removing, updating, sorting, searching etc.. with ease.

Why Java Collection Framework?

Earlier, arrays are used to store the group of objects. But, arrays are of fixed size. You can’t change the size of an array once it is defined. It causes lots of difficulties while handling the group of objects. To overcome this drawback of arrays, Java Collection Framework is introduced from JDK 1.2.

Java Collections Hierarchy :

All the classes and interfaces related to Java collections are kept in java.util package. List , Set , Queue and Map are four top level interfaces of Java collection framework. All these interfaces (except Map) are the sub interfaces of java.util.Collection interface.

Let’s see these primary interfaces one by one.

List :

Intro :

Popular Implementations :

Internal Structure :

Null Elements :

Duplicate Elements :

Order Of Elements :

Synchronization :

Performance :