bvdm23
asked on
Sort a Hashtable
Hello all,
I have a Hashtable with as a key a String and as a value a String.
Now I want to sort this HashTable by the value while still be able to retreive the
key.
Can anybody help me with this?
Thanks in advance,
bvdm23
I have a Hashtable with as a key a String and as a value a String.
Now I want to sort this HashTable by the value while still be able to retreive the
key.
Can anybody help me with this?
Thanks in advance,
bvdm23
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Why I take so much time in typing?????????
Hehehehe :-)
Try a TreeMap with a custom Comparator that compares the mapped values.
By this I mean that you can think of Hashtables, Sets, etc as being like a bag of sweets... To sort them (in order of colour or size), you will have to put them in a struture that can hold order (like a queue, or list) :-)
Hope that makes more sense :-)
Tim