Java Collection API

The Java Collection interface (in package java.util) provides a common way for various kinds of collections to be used. This may make it possible to change the kind of collection used by an application. It also allows use of Java iterators to iterate over the members of a collection.

public interface Collection<AnyType>
       extends Iterable<AnyType> {
int size();
boolean isEmpty();
void clear();
boolean contains ( AnyType x );
boolean add ( AnyType x );
boolean remove ( AnyType x );
java.util.Iterator<AnyType> iterator();

Object[] toArray();
<T> T[] toArray(T[] a);  }

The toArray method allows any Collection to be converted easily to an array.

Contents    Page-10    Prev    Next    Page+10    Index