File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Sorting a Hashtable based on object properties Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "Sorting a Hashtable based on object properties" Watch "Sorting a Hashtable based on object properties" New topic
Author

Sorting a Hashtable based on object properties

Deevis
Greenhorn

Joined: Jul 26, 2001
Posts: 1
I have a Hashtable of server objects...
the key for each entry is the IP address...
the value for each entry is a server object with 3 properties
1) ping (int) - your ping to the server
2) lastVisit (long)- the last time you visited the server ( taken from System.currentTimeMillis()
3) numberVisits (int) - the number of times you've visited the server
Here's the thing - I need to sort the Hashtable in all 3 of the ways above, depending on user selection...
What is the easiest way to do this?

Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Please change your name to be compliant with JavaRanch's naming policy.
Your ID should be 2 separate names with more than 1 letter each. We really want this to be a professional forum and would prefer that you use your REAL name.
Thanks,
Cindy

"JavaRanch, where the deer and the Certified play" - David O'Meara
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Sorting a Hashtable based on object properties
 
Similar Threads
Sorting Hashtables by Object Properties
HashTable
HashTable
Sorting Hashtable by object properties
Session Object space problem