Collection

Java Collection means a single unit of objects. In other words, the java collection framework provides many classes and interfaces. For instance java.util.Collection, java.util.Map, etc. In addition to this, the following are few interfaces –

  • The Iterable interface is the one that acts as the root interface for all collection classes.
  • The collection interface is the one that builds the foundation on which the collection framework depends.
  • The Map interface allows us to store data in key-value pairs.

In addition, collection offers following advantages –

  • Consistent and reusable classes/API.
  • Better performance as less development time.
  • Clean and efficient code.

The collection framework, therefore, helps reduce designing efforts and increases performance. Below is the hierarchy of collection framework –