List listToSort = new ArrayList(myMap.entrySet());
Collections.sort(listToSort, myComparator);

--  Paul Copeland, JOT Object Technologies - http://www.jotobjects.com

> Bhangale, Bhushan wrote:
>
>>I have a datastructure as following:-
>>Key - Value
>>S1  - 23
>>S6  - 12
>>S3  - 4
>>S4  - 7
>>
>>I have to sort on values. I want the key object S3 as its value is the
>>least. How to go about this?
>>
>>I have already done that using TreeMap, but indirectly as TreeMap sorts on
>>Key and not on value. I am looking for straightforward solution if any.
>>
>>Actually S1,S2... are servers and values are number of user connected to it.
>>For doing loadbalancing I am doing this and want the least loaded server.
>>
>>Thanks
>>Bhushan
>>

___________________________________________________________________________
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