Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #11443

Re: exporting a HashMap

From Eric Sosman <esosman@ieee-dot-org.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: exporting a HashMap
Date 2012-01-17 20:38 -0500
Organization A noiseless patient Spider
Message-ID <jf57qu$upe$1@dont-email.me> (permalink)
References <ljv5h7pl5t57ikpoqntvu1iif4tkrl9l7t@4ax.com> <jev0q9$aoo$1@dont-email.me> <lcabh75qqo9b1qtsat1q8g6sobvf0o8iss@4ax.com>

Show all headers | View raw


On 1/17/2012 12:04 PM, Roedy Green wrote:
> On Sun, 15 Jan 2012 12:01:55 -0500, Eric Sosman
> <esosman@ieee-dot-org.invalid>  wrote, quoted or indirectly quoted
> someone who said :
>
>>
>> 	Map<K,V>  map = ...;
>> 	List<Map.Entry<K,V>>  entries =
>> 	    new ArrayList<Map.Entry<K,V>>(map.entrySet());
>> 	Collections.sort(entries, new Comparator<Map.Entry<K,V>>() {
>> 	    @Override
>> 	    public int compare(Map.Entry<K,V>  e1, Map.Entry<K,V>  e2) {
>> 	        return e1.getKey().compareTo(e2.getKey());
>> 	    }
>> 	});
>> 	for (Map.Entry<K,V>  e : entries) { ... }
>
> I have added your technique with attribution to
> http://mindprod.com/jgloss/hashmap.html

     Thanks.  Actually, I thought my other suggestion was slicker,
certainly briefer.

-- 
Eric Sosman
esosman@ieee-dot-org.invalid

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

exporting a HashMap Roedy Green <see_website@mindprod.com.invalid> - 2012-01-15 08:30 -0800
  Re: exporting a HashMap Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-15 12:01 -0500
    Re: exporting a HashMap Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 02:06 -0800
    Re: exporting a HashMap Roedy Green <see_website@mindprod.com.invalid> - 2012-01-17 09:04 -0800
      Re: exporting a HashMap Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-01-17 20:38 -0500
  Re: exporting a HashMap Arne Vajhøj <arne@vajhoej.dk> - 2012-01-15 12:25 -0500
    Re: exporting a HashMap Lew <noone@lewscanon.com> - 2012-01-15 10:22 -0800
      Re: exporting a HashMap Roedy Green <see_website@mindprod.com.invalid> - 2012-01-16 10:55 -0800
        Re: exporting a HashMap Arne Vajhøj <arne@vajhoej.dk> - 2012-01-16 14:55 -0500
          Re: exporting a HashMap Lew <noone@lewscanon.com> - 2012-01-16 14:19 -0800
            Re: exporting a HashMap David Lamb <dalamb@cs.queensu.ca> - 2012-01-16 18:31 -0500
            Re: exporting a HashMap Roedy Green <see_website@mindprod.com.invalid> - 2012-01-17 09:54 -0800
      Re: exporting a HashMap Arne Vajhøj <arne@vajhoej.dk> - 2012-01-16 15:07 -0500
  Re: exporting a HashMap Steven Simpson <ss@domain.invalid> - 2012-01-15 19:22 +0000
  Re: exporting a HashMap Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-01-15 21:02 -0800

csiph-web