File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
[Solved] HashMap, Which thing defines the order of elements
disbling alt+tab key
Hashcode cache query
ThreadLocal use to store Key and Value (like hash map)
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015