Current area: HOME -> Download page

Value Sort Map Utility (Java Code)

  Rate and comment this resource

No Screenshot provided
Download Value Sort Map Utility (Java Code) Product homepage
   (report broken link)
NOTE: Some downloads must be obtained through the publisher's site.
Author: Niraj Agarwal  (View all listings)

Value Sort Map Utility (Java Code)
This class is used to show how you can sort a java.uti.Map for values. This also takes care of null and duplicate values present in the map. Many times we come accross the requirement where we need to sort a Map (HashMap, Hashtable) for it's values. Like User Id's as key and User Name as values; and need to sort it with User Names. This can be good fit for such scenarios.

File name: Unknown
Product homepage: Product homepage
Order page: Unknown
Languages: Java
Platforms: general
Release Date: 1 January, 1900
Licence Type: Unknown
Size: 0 Kb
Price/fee (US$): Unknown
Number of downloads: 591

  User Comments

by anil , on Friday Jun 22, 2007
it is not working when i give numbers as values. its not sorting..but good for the strings
Reply To this Post  Report as abusive.
 
sortByValue(Map map)
by traveler_82@poczta.onet.pl, on Tuesday Jul 03, 2007
static Map sortByValue(Map map) { List list = new LinkedList(map.entrySet()); Collections.sort(list, new Comparator() { public int compare(Object o1, Object o2) { return ((Comparable) ((Map.Entry) (o1)).getValue()) .compareTo(((Map.Entry) (o2)).getValue()); } }); // logger.info(list); Map result = new LinkedHashMap(); for (Iterator it = list.iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry)it.next(); result.put(entry.getKey(), entry.getValue()); } return result; }
Reply To this Post  Report as abusive.

View all comments  Rate and comment this resource


Do you want to get your software listed on this site? If so, click here to find out more.


Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
Localize software in three simple steps
Localize .Net, C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!
Delphi Localization Tool Sisulizer (WYSIWYG)
Create multilingual Delphi apps in three simple steps. Localize XML, HTML Help ... Try Sisulizer now

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.