A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Help required: sorting HashMap values
Joined: Sep 19, 2004
Oct 19, 2005 00:11:00
I want to know how to sort values (not keys) in a HashMap
Joined: Feb 02, 2002
Oct 19, 2005 00:27:00
What problems did you run into while trying to do it?
Joined: Dec 06, 2001
Oct 19, 2005 01:10:00
You can create a list of the Map.Entry objects in the Map and sort them with a custom Comparator. See the link to the API docs in my sig for information on the Map.Entry class and the Comparator interface.
Java API Documentation
The Java Tutorial
subject: Help required: sorting HashMap values
WA #1.....word association
when the HashMap instance need synchronized?
switch on String
hashmap with null values and keys
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014