<?xml version="1.0" encoding="UTF-8"?>











<rss version="2.0" xmlns:jf="http://www.jivesoftware.com/xmlns/jiveforums/rss">



<channel>
    <title>Support Forums: Message List - Sorting HashMap based on its Values</title>
    <link>http://www.theserverside.com</link>
    <description>Most recent forum messages</description>
    <language>en</language>
    
        <generator>Jive Forums Silver 5.5.30 (www.jivesoftware.com)</generator>
    
    <pubDate>Fri, 24 May 2013 16:12:59 -0400</pubDate>


    <item>

        <title>How to count redundant values of HashMap entrysets?</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[<p>How can I count this hashmap? I would like to display:<br/>1. All champions who won more than once - show the number that they won. eg. Uraguay: 2<br/>2. I would like to display the country who won most World Cup: say Brazil: 5<br/><br/>The above...]]></description>
        

        <pubDate>Tue, 13 Jul 2010 17:39:25 -0400</pubDate>

        

        <jf:creationDate>Tue, 13 Jul 2010 17:39:25 -0400</jf:creationDate>
        <jf:modificationDate>Tue, 13 Jul 2010 17:39:25 -0400</jf:modificationDate>
        <jf:date>Jul 13, 2010</jf:date>
        <jf:author>Hui Yang</jf:author>
        <jf:replyCount>0</jf:replyCount>
    </item>


    <item>

        <title>And Another Thing</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Not sure that it's good practise to consider a Map as having an ordering at all.]]></description>
        

        <pubDate>Thu, 16 Mar 2006 09:38:05 -0500</pubDate>

        

        <jf:creationDate>Thu, 16 Mar 2006 09:38:05 -0500</jf:creationDate>
        <jf:modificationDate>Thu, 16 Mar 2006 09:38:05 -0500</jf:modificationDate>
        <jf:date>Mar 16, 2006</jf:date>
        <jf:author>Alex Hill</jf:author>
        <jf:replyCount>0</jf:replyCount>
    </item>


    <item>

        <title>Possible Enhancement</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Along the same lines as Oluwafemi's. Using an annonymous inner class is a little cleaner perhaps.<br><br>----------------------------<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String, Integer&gt; map = new HashMap&lt;String,...]]></description>
        

        <pubDate>Thu, 16 Mar 2006 09:36:39 -0500</pubDate>

        

        <jf:creationDate>Thu, 16 Mar 2006 09:36:39 -0500</jf:creationDate>
        <jf:modificationDate>Thu, 16 Mar 2006 09:36:39 -0500</jf:modificationDate>
        <jf:date>Mar 16, 2006</jf:date>
        <jf:author>Alex Hill</jf:author>
        <jf:replyCount>1</jf:replyCount>
    </item>


    <item>

        <title>Correction</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[In my previous post there were 2 errors - CombinationEntry should be CustomEntry. Here is the corrected version of my message:<br>--------<br><br>I had the same problem - could not sort a map based on values rather than keys. To solve this I simply...]]></description>
        

        <pubDate>Thu, 15 Dec 2005 12:12:20 -0500</pubDate>

        

        <jf:creationDate>Thu, 15 Dec 2005 12:12:20 -0500</jf:creationDate>
        <jf:modificationDate>Thu, 15 Dec 2005 12:12:20 -0500</jf:modificationDate>
        <jf:date>Dec 15, 2005</jf:date>
        <jf:author>Oluwafemi Adetula</jf:author>
        <jf:replyCount>2</jf:replyCount>
    </item>


    <item>

        <title>Solution - Use a List</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[I had the same problem - could not sort a map based on values rather than keys. To solve this I simply created a list of objects, where each object wraps a Map.Entry and implements java.lang.Comparable.<br><br>Here's the class:<br>-----<br>import...]]></description>
        

        <pubDate>Wed, 14 Dec 2005 18:42:17 -0500</pubDate>

        

        <jf:creationDate>Wed, 14 Dec 2005 18:42:17 -0500</jf:creationDate>
        <jf:modificationDate>Wed, 14 Dec 2005 18:42:17 -0500</jf:modificationDate>
        <jf:date>Dec 14, 2005</jf:date>
        <jf:author>Oluwafemi Adetula</jf:author>
        <jf:replyCount>3</jf:replyCount>
    </item>


    <item>

        <title>Use TreeMap</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[I would look at the TreeMap that is available in 1.3 and look at implementing the comparable interfaces to the value objects or provide a comparator object. This should take care of all your probs.<br><br><br><a...]]></description>
        

        <pubDate>Fri, 14 Oct 2005 10:58:50 -0400</pubDate>

        

        <jf:creationDate>Fri, 14 Oct 2005 10:58:50 -0400</jf:creationDate>
        <jf:modificationDate>Fri, 14 Oct 2005 10:58:50 -0400</jf:modificationDate>
        <jf:date>Oct 14, 2005</jf:date>
        <jf:author>Tray Alford</jf:author>
        <jf:replyCount>4</jf:replyCount>
    </item>


    <item>

        <title>How about without LinkedHashMap</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Any ideas on how to do this without using a LinkedHashMap?  We're still on 1.3 which doesn't support LinkedHashMap and I'm not going to get the web admins to upgrade us anytime soon.]]></description>
        

        <pubDate>Mon, 03 Oct 2005 14:01:19 -0400</pubDate>

        

        <jf:creationDate>Mon, 03 Oct 2005 14:01:19 -0400</jf:creationDate>
        <jf:modificationDate>Mon, 03 Oct 2005 14:01:19 -0400</jf:modificationDate>
        <jf:date>Oct 3, 2005</jf:date>
        <jf:author>M J</jf:author>
        <jf:replyCount>5</jf:replyCount>
    </item>


    <item>

        <title>Close, but throws out ties</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[That works if all the values are unique, which isn't true in my case. I ened up with the below.  Maybe somebody can make it better, but it does deal with duplicate values.<br><br><br><br>	public LinkedHashMap sortHashMapByValues(HashMap passedMap,...]]></description>
        

        <pubDate>Thu, 31 Mar 2005 10:23:36 -0500</pubDate>

        

        <jf:creationDate>Thu, 31 Mar 2005 10:23:36 -0500</jf:creationDate>
        <jf:modificationDate>Thu, 31 Mar 2005 10:23:36 -0500</jf:modificationDate>
        <jf:date>Mar 31, 2005</jf:date>
        <jf:author>Tim Ringwood</jf:author>
        <jf:replyCount>7</jf:replyCount>
    </item>


    <item>

        <title>Re: Sorting Maps based on its values</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Thank You, Artem &amp; Anders, That was of great help.<br><br>Regards,<br>Vishal]]></description>
        

        <pubDate>Mon, 25 Oct 2004 06:03:14 -0400</pubDate>

        

        <jf:creationDate>Mon, 25 Oct 2004 06:03:14 -0400</jf:creationDate>
        <jf:modificationDate>Mon, 25 Oct 2004 06:03:14 -0400</jf:modificationDate>
        <jf:date>Oct 25, 2004</jf:date>
        <jf:author>Vishal Revankar</jf:author>
        <jf:replyCount>0</jf:replyCount>
    </item>


    <item>

        <title>Re: Sorting Maps based on its values</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[If it doesn't have to be a 'Hash' map and if you're allowed to leverage some nice open source you may want to consider automaticly sorted maps like the TreeBidiMap (a SortedBidiMap) of Jakarta Commons Collections. Direct link to Javadoc <br><a...]]></description>
        

        <pubDate>Sun, 24 Oct 2004 18:27:07 -0400</pubDate>

        

        <jf:creationDate>Sun, 24 Oct 2004 18:27:07 -0400</jf:creationDate>
        <jf:modificationDate>Sun, 24 Oct 2004 18:27:07 -0400</jf:modificationDate>
        <jf:date>Oct 24, 2004</jf:date>
        <jf:author>Anders Eriksson</jf:author>
        <jf:replyCount>1</jf:replyCount>
    </item>


    <item>

        <title>Sorting HashMap based on its Values</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Something like this, maybe?<br><br>		Map someMap= new LinkedHashMap();<br><br>		someMap.put(&quot;key1&quot;,&quot;c&quot;);<br>		someMap.put(&quot;key2&quot;,&quot;a&quot;);<br>		someMap.put(&quot;key3&quot;,&quot;b&quot;);<br><br>		List mapKeys = new...]]></description>
        

        <pubDate>Thu, 21 Oct 2004 12:22:28 -0400</pubDate>

        

        <jf:creationDate>Thu, 21 Oct 2004 12:22:28 -0400</jf:creationDate>
        <jf:modificationDate>Thu, 21 Oct 2004 12:22:28 -0400</jf:modificationDate>
        <jf:date>Oct 21, 2004</jf:date>
        <jf:author>Artem Yegorov</jf:author>
        <jf:replyCount>8</jf:replyCount>
    </item>


    <item>

        <title>Sorting HashMap based on its Values</title>
        <link>http://www.theserverside.com/discussions/thread.tss?thread_id=29569</link>

        

        
            <description><![CDATA[Hi,<br><br>Can someone suggest me or send a code snippet to sort the HashMap based on its values(not the keys), so that when I display, I get the values in some sorted manner. <br><br>Thanks &amp; Regards,<br>Vishal]]></description>
        

        <pubDate>Thu, 21 Oct 2004 05:01:53 -0400</pubDate>

        

        <jf:creationDate>Thu, 21 Oct 2004 05:01:53 -0400</jf:creationDate>
        <jf:modificationDate>Thu, 21 Oct 2004 05:01:53 -0400</jf:modificationDate>
        <jf:date>Oct 21, 2004</jf:date>
        <jf:author>Mayank Bhargava</jf:author>
        <jf:replyCount>12</jf:replyCount>
    </item>



</channel>
</rss>

