The new JDK 1.4 would have such thing. It is called LinkedHashMap.

Actually, I think that "Sequenced" makes much more sense than 
"Linked" - it is much more clear what it id for. OTOH the 
"HashMap" suffix makes a bit more sense than "Hashtable" because it
is a Map and that follows the newer collections naming scheme.
(So, my favorite name for such thing would be "SequencedHashMap".)

You can read about it here:
http://java.sun.com/j2se/1.4/docs/guide/collections/changes4.html

There are some other interesting collections too, like the
LinkedHashSet and the IdentityHashMap.


Have fun,
Paulo Gaspar


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, August 29, 2001 10:12 PM
> 
> 
> Lavandowska <[EMAIL PROTECTED]> writes:
> 
> > --- Charles Burdick <[EMAIL PROTECTED]> wrote:
> > > --- Daniel Rall <[EMAIL PROTECTED]> wrote:
> > > > > What is SequencedHashtable used for?
> > > > 
> > > > It keeps track of the order in which elements are added to a
> > > > Hashtable.
> > 
> > > TreeMap uses a Red-Black tree to keep the keys of the map in order,
> > > either according to their natural order or according to a given
> > > Comparator.
> 
> Thanks Charles, I wasn't aware of that class.
> 
> > Notice the difference: "the order in which elements are added" versus
> > "according to their natural order".  This means that if I enter the
> > Strings "a", "c", "b" (in that order), they will return:
> > SequencedHashtable: a,c,b
> > TreeMap: a,b,c
> 
> Lance illustrates the difference lucidly.  One could extend TreeMap to
> provide an unsync'd version of a class with behavior like
> SequencedHashtable's.
> 
> Daniel
> 

Reply via email to