Java Reference
In-Depth Information
Class
Description
Vector
Lists:
Implements a list as an array that automatically increases in
size to accommodate as many elements as you need. Objects
are stored and retrieved using an index as in a normal array.
You can also use an iterator to retrieve objects from a
Vector . The Vector is the only container class that is
synchronized - that is, it is well-behaved when concurrently
accessed by two or more threads. We will discuss threads and
synchronization in the next chapter.
Stack
This class is derived from Vector and adds methods to
implement a stack - a last-in first-out storage mechanism.
LinkedList
Implements a linked list. The linked list defined by this class
can also be used as a stack or a queue.
ArrayList
Implements an array that can vary in size and can also be
accessed as a linked list. This provides a similar function to
the Vector class but is unsynchronized.
Maps:
Hashtable
Implements a map where all keys must be non-null. The class
defining a key must implement the hashcode() method
and the equals() method to work effectively. This class is a
legacy of previous Java implementations and it is usually
better to use the other classes that implement maps.
HashMap
Implements a map that allows null objects to be stored and
allows a key to be null (only one of course, since keys must
be unique).
LinkedHashMap
Inplements a map with all of its entries in a doubly-linked
list. This class can be used to create a copy of a map of any
type such that the order of the entries in the copy is the same
as the original.
WeakHashMap
Implements a map such that if a key to an object is no longer
referenced ordinarily, the key/object pair will be discarded.
This contrasts with HashMap where the presence of the key
in the map maintains the life of the key/object pair, even
though the program using the map no longer has a reference
to the key, and therefore cannot retrieve the object.
IdentityHashMap
Implements a map using a hash table where comparisons in
searching the map for a key or a value compares references,
not objects. This implies that two keys are equal only if they
are the same key. The same applies to values.
TreeMap
Implements a map such that the objects are arranged in
ascending key order.
Search WWH ::




Custom Search