Java Collection Framework Overview
2024-12-11
/
Java Collection Framework Series
Java Collection Framework is a set of classes and interfaces that provides a ready-made framework to manipulate groups of objects efficiently, like storing, searching, and sorting data. The collection can be viewed as a container used to store object data. All collection classes are located in the java.util
package, while the collection classes that support multithreading are found in the java.util.concurrent
package.
The Java collection classes are primarily derived from two root interfaces: Collection and Map.
Collection Family:
Map Family:
There are several generic types of Collection: Lists, Queues, Maps, and Sets.
- Lists (
java.util.List
): a more flexible array where elements have a specific order and allow for the existence of identical elements. - Queues (
java.util.Queue
): allow to insert items in a certain order and retrieve those items in the same order. - Maps (
java.util.Map
): store references to objects with a lookup key to access the object’s values. - Sets (
java.util.Set
): unordered collections that can be iterated and contain each element at most once.