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


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

Re: exporting a HashMap

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Lew <noone@lewscanon.com>
Newsgroups comp.lang.java.programmer
Subject Re: exporting a HashMap
Date Sun, 15 Jan 2012 10:22:08 -0800
Organization albasani.net
Lines 24
Message-ID <jev5gh$bum$2@news.albasani.net> (permalink)
References <ljv5h7pl5t57ikpoqntvu1iif4tkrl9l7t@4ax.com> <4f130c08$0$292$14726298@news.sunsite.dk>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 8bit
X-Trace news.albasani.net MfcdawAU/oBcBDP1AT0Zgd/KKe+e5kG/PzArBslqiEu8EP6crKORSyYd3YrgaoCqGMzfhfLf7dxlmHZPFblxpwTujv8BLa/VFIxHr5OKu+20o00hZNiFxTnHHqUVz2k5
NNTP-Posting-Date Sun, 15 Jan 2012 18:22:09 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="xxyjDMopZm40RiRtf6YKHwRlLH4PPRUMO4pyg/5DrQUkTYPZuBBbeitbThy1GrvHKCElK8onPWe/KQ3Gbb3PQqyaR0x01uruBrjljP2pBu4N0slh/DisO2qdBZa4RDcK"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111109 Thunderbird/3.1.16
In-Reply-To <4f130c08$0$292$14726298@news.sunsite.dk>
Cancel-Lock sha1:P6vU0ERjid9PJ89THpAxvq09J9M=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11355

Show key headers only | View raw


Arne Vajhøj wrote:
>  Roedy Green wrote:
>> What is best code to export key-value pairs from a HashMap into some
>> structure in key-value order.
>>
>> One possible way is to extract the keys, sort them, then look up the
>> values. That strikes me as infantile. Surely there is a better way.
>>
>> The best I can think of is to invent a Pair dummy class, extract the
>> fields from an Entry into the two fields, and sort them in an array.
>>
>> Part of the problem is generics and arrays don't mix.
>
> Generics and ArrayList mix fine.

And anyway, generics and arrays do mix, just not well. To say merely that they 
don't mix, without the qualifier "well", isinaccurate and misleading, and 
certainly no help to newbies. Better would be to explain the limits, why they 
exist, and what the alternatives are.

-- 
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedia/commons/c/cf/Friz.jpg

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