2012:01:19 15:26:04

Commonly used methods of Collection interface

1. public boolean add(object element) : is used to insert an element in this collection.
2. public boolean addAll(Collection c) : is used to insert the specifed collection elements in the invoking collection.
3. public boolean remove(object element) : is used to delete an element from this collection.
4. public boolean removeAll(Collection c) : is used to delete all the elements of specifed collection from the invoking collection.
5. public boolean retainAll(Collection c) : is used to delete all the elements of invoking collection except the specified collection.
6. public int size() : return the total number of elements in the collection.
7.public void clear() : removes the total no of element from the collection.
8. public boolean contains(object element) : is used to search n element.
9. public boolean containAll(Collection c) : is used to search the spetified collection in this collection.
10. public Iterator itgerator() : returns an iterator

Iterator interface :

Iterator interface provides the facility of iterating the elements in forward direction only.

Methods of Iterator interface
1. public boolean hasNext();
2. public object next();

Posted by jeonguk