An introduction to collections

The collections framework is a set of classes and interfaces that provides a unified architecture for performing common groups of data related operations, such as the following:

  • Searching
  • Sorting
  • Insertion
  • Deletion
  • Manipulation

All the lists, maps, and sets we use in our programs everyday are part of this collections framework.

All collections frameworks contain the following things:

  • Interfaces: These are abstract data types are used to represent collections. Interfaces allow collections to be manipulated independent of the details of their representation. In object-oriented languages, these are generally interfaces form a hierarchy.
  • Implementations: These are concrete implementations of the collection of interfaces. In essence, these are reusable data structures.
  • Algorithms: Methods that perform useful computations, such as searching and sorting (as listed earlier), on objects that implement collection interfaces. These algorithms are said to be polymorphic. The same method can be used on many different implementations of the appropriate collection interface. In short, algorithms are a reusable functionality.

Apart from the Java and Kotlin collections framework, the best-known examples of collections framework are the C++ Standard Template Library (STL) and Smalltalk's collection hierarchy.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.85.181