Hi,

You can use an Association instead of Hashtable, if you want to keep the
order!! Of course there is not any Association class in JDK so you should
simulate it by using two Vectors. One for keeping the values and another for
keeping the keys.

Regards,
Arnold

-----Original Message-----
From: Darren Houle <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Tuesday, March 23, 1999 7:23 AM
Subject: Re: Java Question


>I actually tried using a vector as you suggest just a while ago and it
works the way I need.  I cannot use just a vector as my data is too complex
for a single dimensional storage object, I'm using a master hashtable that
has names as keys and sub-hashtables as values, the sub-hashtables have
attributes as keys and vectors as values, the vectors are lists of values
that go with each attribute.  I needed a way to pull out the top level
last_name keys in alpha order and using a vector in parallel with the master
hashtable seems to work fine.
>
>Thanks again,
>Darren
>
>>>> "Robert A. Crawford" <[EMAIL PROTECTED]> 03/23 10:45 AM
>Hashtables are not ordered -- in fact, they very specifically
>"mix" the order to make it possible to retrieve the element very
>quickly. Find a good book on data structures for more information.  The
simple way to fix this is to use a Vector -- they're
>ordered. Either slip the last name into the Vector as you're loading,
>then step through the Vector and use the last name as a key into the
Hashtable, or just put everything into the Vector and use it
>directly....
>
>___________________________________________________________________________
>To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
>of the message "signoff SERVLET-INTEREST".
>
>Archives: http://archives.java.sun.com/archives/servlet-interest.html
>Resources: http://java.sun.com/products/servlet/external-resources.html
>LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to