This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Probably you need to give some more info on what you are trying to do. If there are two Hashtables in an array, how do we tell which one should go first? The one with the most elements? The one whose key comes first if sorted in alphabetical order? Should entries from different hashtables be kept in their original hashtables, or merged together while sorting? There are too many possiblilities here.
"I'm not back." - Bill Harding, Twister
Joined: Mar 01, 2001
Hai Jim, I need to sort an ArrayList of Hashtables. Arraylist contains 100 hashtable entries where there are 4 elements in a hashtable. All the hashtables contains the same number of elemnts. I need to be sorted by first element in the hashtable which is numeric. The results should be kept in the hashtables itself. I think i answered your question. If any questions please let me know. Thanks Padmaja
Joined: Jan 30, 2000
Unfortunately, a hashtable doesn't have a "first element". It doesn't matter what order you added the elements to the hashtable; no particular internal order in guaranteed for the hashtable. If order is important, you can't use a hashtable. Why don't you show an example of the data in one complete hashtable, and which part of that data is the "first element" you wich to sort with.