Apr 13, 2012

Collection Interface

Collections Framework consists of interfaces and classes for working with group of objects. At the top of the hierarchy lies the Collection interface:
public interface Collection
All Known Subinterfaces: List,Set,Queue
Some of the Implementing Classes:
ArrayList, HashSet, LinkedHashSet, LinkedList, TreeSet, Vector
The Collection interface is used to represent any group of objects, or elements. You use the interface when you wish to work with a group of elements in as general a manner as possible.
The 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 present.
Some Important Methods
add(Object o)   Ensures that this collection contains the specified element.
contains(Object o) Returns true if this collection contains specified element.
isEmpty()   Returns true if this collection contains no elements.
size()     Returns the number of elements in this collection.


Post a Comment