@[toc]

Introduction to Java Collection Framework

  • The Java Collections Framework is a unified architecture for representing and manipulating collections, enabling them to operate independently of the details of the presentation. It reduces programming effort and improves performance. It supports interoperability between unrelated apis, reduces the effort of designing and learning new apis, and promotes software reuse. The framework is based on more than a dozen collection interfaces and includes implementations of these interfaces and algorithms for manipulating them.

The collections framework is a unified architecture for representing and manipulating collections, enabling them to be manipulated independently of the details of their representation. It reduces programming effort while increasing performance. It 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. It includes implementations of these interfaces and algorithms to manipulate them.

Java common set UML class diagram

  • The relationships between classes commonly used by Java collections frameworks are shown in the following UML class diagram (some of the implemented identity interfaces are not shown in the diagram, such as Serializable serialization interface, Cloneable clone interface, RandomAccess interface) :

  • In addition to the Collections framework classes, you also have the Collections and Arrays classes, which contain static methods.
  • According to the UML class diagram of Java Collection framework:
    • Java collections framework consists of two main types, one is a Collection (store a Collection of elements) and the other is a Map (store key/value pair mapping).
    • The three direct subinterfaces of the Collection interface (which stores a non-unique, unordered set of objects) are:
      • List (stores a List of non-unique, ordered objects)
      • Set (stores a Set of unique, unordered objects)
      • Queue (A collection designed for holding elements before processing. Besides basic Collection operations, queues provide additional insertion, extraction, and inspection operations.)
  • AttentionThe direct parent of the TreeSet implementation is NavigableSet, which inherits the SortedSet interface

Reference: official Java API documentation: docs.oracle.com/javase/8/do…