5 Java Collections Framework

The Java platform includes a collections framework that provides developers with a unified architecture for representing and manipulating collections, enabling them to be manipulated independently of the details of their representation. A collection is an object that represents a group of objects (such as the classic ArrayList class).

The Java Collections Framework enables interoperability among unrelated APIs, reduces effort in designing and learning new APIs, and fosters software reuse. The framework is based on more than a dozen collection interfaces, and includes implementations of these interfaces with the algorithms to manipulate them.

Overview

The Java Collections Framework consists of:

  • Collection interfaces: Represent different types of collections, such as sets, lists, and maps. These interfaces form the basis of the framework.
  • General-purpose implementations: Primary implementations of the collection interfaces.
  • Legacy implementations: The collection classes from earlier releases, Vector and Hashtable, were retrofitted to implement the collection interfaces.
  • Special-purpose implementations: Implementations designed for use in special situations. These implementations display nonstandard performance characteristics, usage restrictions, or behavior.
  • Concurrent implementations: Implementations designed for highly concurrent use.
  • Wrapper implementations: Add functionality, such as synchronization, to other implementations.
  • Convenience implementations: High-performance "mini-implementations" of the collection interfaces.
  • Abstract implementations: Partial implementations of the collection interfaces to facilitate custom implementations.
  • Algorithms: Static methods that perform useful functions on collections, such as sorting a list.
  • Infrastructure: Interfaces that provide essential support for the collection interfaces.
  • Array Utilities: Utility functions for arrays of primitive types and reference objects. Not, strictly speaking, a part of the collections framework, this feature was added to the Java platform at the same time as the collections framework and relies on some of the same infrastructure.

See Java Collections Framework for detailed information about the interfaces and implementations contained in the Java Collections Framework.

See The Java™ Tutorials for basic information about using the Java Collections Framework.