Home | Ajax | BioInformatics | Dojo | EAI | EJB | Hibernate | J2ME | Java | Java Glossary | Java Servlets | JavaScript | Jboss | JDBC | JDO | Jmeter | JSF | JSP | JUnit | Maven | MySQL | Spring Framework | SQL | Struts | Technology | WAP | Web Services | XML


 
  
 
Programming Tutorials: Ajax | Articles | JSP | Bioinformatics | Database | Free Books | Hibernate | J2EE | J2ME | Java | JavaScript | JDBC | JMS | Linux | MS Technology | PHP | RMI | Web-Services | Servlets | Struts | UML
 

 
Facing Programming Problem?
Ask Questions?, Browse Latest Questions, Question-Answer Guidelines
Java
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments

Collection Interfaces

                         

The Collections Framework is made up of a set of interfaces  for storing and manipulating groups of data into a single unit. It consists of several interfaces, and classes that implement those interfaces, contained within the java.util package. It provides tools for maintaining a data container of objects. 

Different interfaces describe different types of functionalities.

The following diagrams shows the framework of core collection interfaces hierarchy.


Table of the ordered and unordered Collection interfaces shown as:

 Interface name  Ordered  Allows duplicates  Maps key to object
 Collection  No  Yes  No
 Set  No  No  No
 List  Yes  Yes  No
 Map  No  No  Yes
 SortedSet  Yes  No  No
 SortedMap  Yes  No  Yes

Collection Interface:

The Collection interface is the root interface for the Java collections hierarchy. It is extended by the List, Set, and the SortedSet interfaces. The Collection interface is used to represent a group of objects, or elements. Typically, it represents data items that form a natural group. Some collection allows duplicate elements while others do not. It consists of both ordered and unordered elements.

 The declaration of the Collection interface is shown as:

public interface Collection<E>.. 

The <E> syntax tells that, the declared interface is a generic interface i.e. when you declare a Collection instance you should specify the type of object contained in the collection.
This interface supports basic operations like adding and removing. When you try to remove an element, only a single instance of the element in the collection is removed, if it is available. 

Following methods can be used for adding and deleting an element respectively.

boolean add(Object element)      
boolean remove(Object element)

The list of other methods belonging to the Collection interface is shown in the table given below

Method

Uses

 add(E o)
    
  Adds the specified element to this set if it is not already present (optional operation).
         
 clear()   Removes all of the elements from this set (optional operation).
contains(Object o)  Returns true if this set contains the specified element.
 equals(Object o)   Compares the specified object with this set for equality.
 hashCode()   Returns the hash code value for this set.
  isEmpty()    Returns true if this set contains no elements.
 iterator()   Returns an iterator over the elements in this set.
 remove(Object o)   Removes the specified element from this set if it is present (optional operation).
 size()   Returns the number of elements in this set (its cardinality).

                         

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

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

yeh,i understand some concepts from this tutorial,really it is helpedme alot......

Posted by raj on Monday, 11.12.07 @ 14:21pm | #36953

Latest Searches:
Aspect_oriented progra
mapping dispatch actio
file uploading code us
typecast between strin
java Game manager
downloadawebpageusings
IPO Charts
Swing Jlabel images
json lib/components/co
JSP radiobuttons
Thread Sleep Method
generatepdffileforexce
convert string array t
Fireworks Special Effe
java / menu bar
display message in app
example of Jtext area
j2me stringItem static
jsp mysql combo box
Hash maps in struts2
bean:define
Display error in JSP
java program to find s
json lib/errors.php?er
AUMLtutorial
Create resource bundle
class diagrams in UML
identifyobjectsonawebp
Take user input using
J-Integra Excel exampl
sea
howtoretrievedatabasei
sample notepad source
login eample code usin
Java Checkbox Example
jdbc question
how to create tree usi
java servelt programe
json lib/componen...]=
'string variable in sw
free download taglibs-
j2me stringItem
check box
getFile
struts programs
Service Locator
trees
Hospital UML diagrams
concatenatedWord
exampleofJFileChooser
<jsp:setProperty
add Sort In Java
diamond code
login jsp
Eclipse3.4EJB
how to manipulate file
xml database
open excel from java
callable
java file browser
readLine( )
implementing stack usi
struts.jar download
For String manipulatio
date midlet
DynaAction Form
Reading File into Byte
List in J2ME
Photoshop Web Graphics
merge file
frame in html
student example in str
ASP Database Related C
Ajax Patterns and Best
reservation
JSP:File Input Paramet
construct a down trian
java io
c language
current
Java String toLowerCase Example
Java String toCharArray Example
Java String substring Example
Java String indexOf Example
Java String startsWith Example
Java String hashCode Example
Java String matches Example
Java String length Example
Java String lastIndexOf Example
Java String isEmpty Example
Java String equalsIgnoreCase Example
Java String equals Example
Java String endsWith Example
Java String copyValueOf Example
Java String contentEquals Example
  EAI Articles
  Java Certification
Tell A Friend
Your Friend Name
Search Tutorials

 

 
 
Browse all Java Tutorials
Java JSP Struts Servlets Hibernate XML
Ajax JDBC EJB MySQL JavaScript JSF
Maven2 Tutorial JEE5 Tutorial Java Threading Tutorial Photoshop Tutorials Linux Technology
Technology Revolutions Eclipse Spring Tutorial Bioinformatics Tutorials Tools SQL
 

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 | 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.