Advertisement

Google Ad Slot: content-top

Java Collections API


The Java Collections Framework (JCF) is a set of interfaces and classes that provide efficient ways to store, manipulate, and process data in Java. It is part of the java.util package and provides implementations for lists, sets, maps, queues, and more.


Collection Framework Hierarchy:

Java Collections API is structured as follows:

Collection Interface (Root Interface)

🔹 List → Ordered collection (e.g., ArrayList, LinkedList)

🔹 Set → Unique elements only (e.g., HashSet, TreeSet)

🔹 Queue → FIFO (First-In-First-Out) (e.g., PriorityQueue, LinkedList)

Map Interface (Separate from Collection)

🔹 Map → Key-Value pairs (e.g., HashMap, TreeMap, LinkedHashMap)


Key Interfaces & Implementations:

Interface

Features

Implementations

List

Ordered, allows duplicates

ArrayList, LinkedList, Vector

Set

No duplicates

HashSet, LinkedHashSet, TreeSet

Queue

First In First Out processing

PriorityQueue, Deque

Map

Key-Value storage

HashMap, TreeMap, LinkedHashMap, Hashtable