Java Collections

Let us start this advanced concepts with Collections, which is most important framework in Java language. 
  • A Collection is a group of objects.
  • A collection sometimes called a container is simply an object that groups multiple elements into a single unit. 
  •   Collections are used to store, retrieve, manipulate, and communicate aggregate data.



What Is a Collections Framework?


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

  • Interfaces: These are abstract data types that represent collections. Interfaces allow collections to be manipulated independently of the details of their representation. In object-oriented languages, interfaces generally form a hierarchy.
  • Implementations: These are the concrete implementations of the collection interfaces. In essence, they are reusable data structures.
  • Algorithms: These are the methods that perform useful computations, such as searching and sorting, on objects that implement collection interfaces. The algorithms are said to be polymorphic: that is, the same method can be used on many different implementations of the appropriate collection interface.
Benefits of the Java Collections Framework:

The Java Collections Framework provides the following benefits:

  • 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 work.
  • Increases program speed and quality: This Collections Framework provides high-performance, high-quality implementations of useful data structures and algorithms. The various implementations of each interface are interchangeable, so programs can be easily tuned by switching collection implementations. Because you're freed from the drudgery of writing your own data structures, you'll have more time to devote to improving programs' quality and performance.
Now let us see each part of collection framework in detail.

INTERFACES:   

           The Collection Framework defines several interfaces. This section provides an overview of each interface. 
Fig: The Collection Interface Hierarchy.


No comments:

Post a Comment