Collection interface

Collection interface
  • If we want to represent a group of individual objects as a single entity then we should go for Collection interface.
  • Collection interface defines the most common general methods which can be applicable for any Collection object.
  • The following is the list of methods present in Collection interface.
  1. boolean add(Object o);
  2. boolean addAll(Collection c);
  3. boolean remove(Object o);
  4. boolean removeAll(Object o);
  5. boolean retainAll(Collection c); // To remove all objects except those present in c.
  6. void clear();
  7. boolean contains(Object o);
  8. boolean containsAll(Collection c);
  9. boolean isEmpty();
  10. int size();
  11. Object[] toArray();
  12. Iterator iterator();

  There is no concrete class which implements Collection interface directly.

Collection interface


Scroll to top