Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
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.

                         

» View all related tutorials
Related Tags: c algorithm api ide collections orm ant data form interface framework software io multiple ip order vi collection tag int

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 

Current Comments

8 comments so far (
post your own) View All Comments Latest 10 Comments:

i don't know about java before using this website. so it's very useful for all users...
thank you

Posted by sakthi.s on Sunday, 12.14.08 @ 11:50am | #82746

send all concepts in java with examples

Posted by ramya on Friday, 09.19.08 @ 14:52pm | #80494

PLEASE SEND SOME EXAMPLES on this to my mail

Posted by ramya on Friday, 09.19.08 @ 14:51pm | #80493

Handle the exception with try/catch clause.

sytax is as under.

try{

put you code here ------
}

catch(NullpointerExcepiton e) {
}

Posted by G.Nageswara Rao on Friday, 06.13.08 @ 12:32pm | #63188

i love your examples.
please could please send some more examples on collections to my email box.
Any effort to do this will be highly appreciated

Posted by Uche on Friday, 05.30.08 @ 17:48pm | #61449

When u run it did it tell u to initialize the idcombo...if yes what value u will assign...

or else try out by creating an object like this...
JComboBox idcombo = new JComboBox();

Posted by satish on Monday, 12.17.07 @ 11:50am | #42688

idcombo.addItem(Interger.toString(getInt(1)));

in the above staement type spelling of Integer correctly

Posted by rajesh on Wednesday, 10.10.07 @ 18:18pm | #33010

Hai,

I have the Error of Run time Exception: Null Pointer Exception in the following program.

This is a sample program of JDBC concept.

JComboBox idcombo;

rs.ResultSet("SELECT p_id FROM product);

while(rs.next())
{
idcombo.addItem(Interger.toString(getInt(1)));
}

con.close();

idcombo.ActionItemListener(this);

Please Guide me how to avoid this Error.

Regards

Your friend

G.Aranganathan

Posted by Aranganathan on Saturday, 09.29.07 @ 20:19pm | #30485

Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.