Encyclopedia > Collections API

  Article Content

Java Collections API

Redirected from Collections API

The Java Collections API contains classes and methods that facilitate the grouping and organization of objects (see official documentation (http://java.sun.com/j2se/1.4.1/docs/api/java/util/Collection)).

The List interface enables the programmer to aggregate objects and then traverse the list, as when performing some operation on each of the list's members.

The Set interface enforces the rule that no two objects it contains are equal to each other. An OrderedSet (backed by a TreeSet) keeps the objects in order.

A Map maintains a one-to-one mapping of key to object -- handy for doing look-ups. For example, if you know a City, you can use a Map to find look up the corresponding Country.

Objects are kept in order by using a Comparator whose compareTo method defines a natural ordering of objects. Often the compareTo method is defined in the class definition of the objects themselves, rather than being in a separate Comparator object.

See: Java API



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
French resistance

... (poet, communist resistance) Marie Fourcade[?] André Gide André Malraux (“Colonel Berger”) Julien Meline[?] Pierre Mendès-France[?] Christian Pineau Odette ...

 
 
 
This page was created in 31.4 ms