Collection Interface;
- Collection is group of individual objects as single entity
- It is root interface of Collection Framework
- Define most common method which is applicable for all collection object
Methods of Collection interface
- bollean add (Object o)
- boolean addAll(Collection c)
- boolean retainAll(Collection c):- To remove all object except present in c
- boolean containsAll(Collection c)
- boolean remove (Object o)
- void clear()
- Boolean isEmpty()
- int size()
- Boolean contains(Object o)
- Object[] o= c.toArray()
- Iterator i = c.iterator()
Note:-
- Collection interface doesn’t contain any method to retrieve objects
- There is no concrete class which implements collection class directly
- Usually we can use Collections to hold and transfer Objects from one place to another, to provide the support for this requirements Collection already implements Serializable and Cloneable Interfaces.
0 comments: