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 | |
boolean | add(Object o) Ensures that this collection contains the specified element. |
boolean | contains(Object o) Returns true if this collection contains specified element. |
boolean | isEmpty() Returns true if this collection contains no elements. |
int | size() Returns the number of elements in this collection. |
0 comments :
Post a Comment