DEV Community

Deepikandas
Deepikandas

Posted on • Edited on

#36 Known is a drop! Collection Framework in JAVA

Collections Framework

├── Collection (interface)
│ ├── List
│ │ └── ArrayList, LinkedList, Vector (Stack via Vector)
│ │
│ ├── Set
│ │ └── HashSet, LinkedHashSet, TreeSet
│ │
│ └── Queue
│ └── Deque
│ └── LinkedList, ArrayDeque

├── Map (separate hierarchy)
│ ├── HashMap
│ ├── LinkedHashMap
│ └── TreeMap

└── Collections (utility class)

Collections Framework
├── Data Structures (ArrayList, HashMap, etc.)
├── Interfaces (List, Set, Queue, Map)
└── Utilities (Collections class)

Definition: Java Collections Framework
The Java Collections Framework is a unified architecture that provides a set of interfaces and classes to store, manage, and manipulate groups of objects efficiently.
Simple definition:
Collections in Java is a framework that provides classes and interfaces to store and manipulate groups of objects efficiently.

Collection (Interface)
Collection is a root interface in Java Collections Framework.
Key points:
It is an interface
Parent of List, Set, Queue
Defines basic operations like:
add()
remove()
size()
2. Collections (Utility Class)
👉 Collections is a utility class in java.util package.
It provides static methods to operate on collections.
Collections.sort(list);
Collections.reverse(list);
Collections.shuffle(list);
A utility class is a class that provides only reusable helper methods (usually static methods) and is not meant to be instantiated.
Key points:
It is a class
Contains only static methods
Used for:
sorting
searching
reversing
synchronizing
Why do we need the Collections Framework in Java?
The Java Collections Framework is a complete system that provides data structures + rules + utility operations to manage data efficiently.

  • No need to write data structures from scratch
  • High performance implementations
  • Standard structure (uniform API)
  • Reusability
  • Built-in algorithms
  • Easy maintenance
  • Limitations of arrays are one of the key reasons the Collections Framework was introduced in Java.

Top comments (0)