Introduction to Collections API

A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes.

Introduction to Collections API


As the name indicates, collections is a group of objects known as its elements. Basically it is a package of data structures that includes ArrayLists, LinkedLists, HashSets, etc. A collection is simply an object that groups multiple elements into a single unit. It is also called as a container sometimes. It is used to store, retrieve, manipulate, and communicate aggregate data. Typically, it represents data items that form a natural group and allows duplicate elements while others do not. It consists of both ordered and unordered elements. There is no direct implementation of this interface however SDK provides implementations of more specific sub interfaces like Set and List. The manipulation and passing of collections is done by this interface.

The Two "standard" constructors should be provided by all the general-purpose Collection implementation classes. These classes typically implement Collection indirectly through one of its sub interfaces.

  1. Void (no arguments) constructor which creates an empty collection.

  2. Constructor with a single argument of type Collection, which creates a new collection with the same elements as its argument.

The user can copy any collection using void constructor to produce an equivalent collection of the desired implementation type. As interfaces cannot contain constructors there is no way to enforce this convention. However all of the general-purpose Collection implementations comply this in the Java platform libraries.  

The Java Collections API:

Java Collections of API (Application Programming Intreface) Consists of several interfaces, and classes that implement those interfaces, within the java.util package. It provides tools for maintaining a data container of objects. Each primitive value must be wrapped in an object of its appropriate wrapper class (Boolean, Character, Integer, Double, etc.) to maintain a collection of primitive data. It is an alternative tool to the creation of custom data structures.

You must be familiar with collections if you have worked with Java programming language . Collection implementations included Vector, Hashtable, and array are available in earlier (pre-1.2) versions of the Java platform, but those versions do not include the collections framework. Hence the new version of the Java platform contains the collections framework.

Share on Google+Share on Google+

Introduction to Collections API

Posted on: June 22, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles



Discuss: Introduction to Collections API   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
June 30, 2011

what is difference between vector and Array List. Give me one example for vector using synchronization?
July 19, 2011
About Collection

About collection
August 13, 2011

Good explanation at collection.. Evn a lay man can understand easily while reading this... Thank u...
August 19, 2011
my opinion

very goood
September 22, 2011

Shiver me tmbiers, them's some great information.
September 30, 2011

VERY USEFUL................
December 13, 2011

I Love u ROSE.....After i visit this site I got many Ideas about JAVA.......
Ashutosh Rawat
December 24, 2011
Collection API

please send me videos of Collection API
amit kumar
October 23, 2012

What is collection of api example usage .