Collection tutorial java

A collection is simply an object that represents a group of objects into a single unit.

Collection framework:

A collection framework is a unified architecture or a set of classes and interfaces for representing and manipulating collections. i.e. collection framework is used to store, retrieve and manipulate collections.

Collection framework contains the following:

  1. Interfaces are abstract data types that represent collections and allow collections to be manipulated independently of the details of their representation.
  2. Classes/Implementations are the concrete implementations of the collection interfaces.
  3. Algorithms: are the methods used for collection computations, like searching and sorting.

Advantages/Benefits of collection framework:

  1. Reduces programming effort: Collection framework provides useful data structure and algorithms for collection manipulation, you not have to write them.
  2. Increases program speed and quality: The collection framework provides high-performance and high-quality implementations of useful data structures and algorithms which increase the speed and quality.
  3. Resizable: Collection is resizable.
  4. Reduces effort to design new APIs: because the collection framework eliminates the need to produce ad hoc collections APIs.

Disadvantages of collection framework:

  1. It must cast to the correct type.
  2. It can’t be done compile-time type checking.

Note: Above two disadvantages can be removed from the collection framework by using generics.
Core Collection Framework interfaces are categories into two sets collections and maps.
Note: Maps are not an integral part of the collection framework but are considered as collections because they can store and manipulate groups of objects like collections.

Collection tutorial:

 

Content Protection by DMCA.com
Please Share