What Is a Collections Framework?

A collections framework is a unified architecture for representing and manipulating collections. All collections frameworks contain the following:

  • Interfaces
  • Implementations
  • Algorithms

Benefits of the Java Collections Framework

  • Reduces programming effort: By providing useful data structures and algorithms, the Collections Framework frees you to concentrate on the important parts of your program rather than on the low-level “plumbing” required to make it work.
  • Increases program speed and quality: This Collections Framework provides high-performance, high-quality implementations of useful data structures and algorithms.

Collection Interfaces:

The core collection interfaces encapsulate different types of collections, which are shown in the figure below.

  1. Collection — Root of the collection hierarchy.  The Collection interface is the least common denominator that all collections implement. Some types of collections allow duplicate elements, and others do not.
  2. Set — A collection that cannot contain duplicate elements.
  3. List — An ordered collection.  List can contain duplicate elements.
  4. Queue — A collection used to hold multiple elements prior to processing. Queues typically, but do not necessarily, order elements in a FIFO (first-in, first-out) manner.
  5. Deque — A collection used to hold multiple elements prior to processing. Deques can be used both as FIFO (first-in, first-out) and LIFO (last-in, first-out). In a deque all new elements can be inserted, retrieved and removed at both ends.
  6. Map — An object that maps keys to values. A Map cannot contain duplicate keys; each key can map to at most one value.

The last two core collection interfaces are merely sorted versions of Set and Map:

  • SortedSet — A Set that maintains its elements in ascending order.
  • SortedMap — A Map that maintains its mappings in ascending key order.

This was just an overview, I will be covering each Interfaces and its implementation in upcoming posts marked under Collections category. Stay Tuned…



Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *