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
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
I agree. Here's the link:
subject: Help required: sorting HashMap values
switch on String
when the HashMap instance need synchronized?
WA #1.....word association
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