The central interfaces of he Collections Framework are : Collection « Utility Classes « SCJP






java.util.Collection
java.util.List (which extends Collection)
java.util.Set (which also extends Collection)
java.util.Map (which doesn't extend Collection)

import java.util.Collection;
import java.util.Iterator;

public class MainClass {
  public static void main(String[] argv) {
    System.out.println();
  }

  public void dumpCollection(Collection c) {
    System.out.println("Collection has" + c.size() + " elements.");
    Iterator iter = c.iterator();
    while (iter.hasNext())
      System.out.println("Next element is" + iter.next());
  }

}








8.11.Collection
8.11.1.The central interfaces of he Collections Framework are
8.11.2.Collection: add(Object x) Adds x to this collection
8.11.3.Collection: addAll(Collection c) Adds every element of c to this collection
8.11.4.Collection: clear() Removes every element from this collection
8.11.5.Collection: contains(Object x) Returns true if this collection contains x
8.11.6.Collection: containsAll(Collection c) Returns true if this collection contains every element of c
8.11.7.Collection: isEmpty() Returns true if this collection contains no elements
8.11.8.iterator() Returns an Iterator over this collection (see below)
8.11.9.Collection: remove(Object x) Removes x from this collection
8.11.10.Collection: removeAll(Collection c) Removes every element in c from this collection
8.11.11.Collection: retainAll(Collection c) Removes from this collection every element that is not in c
8.11.12.Collection: size() Returns the number of elements in this collection
8.11.13.Collection: toArray() Returns an array containing the elements in this collection