Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #11371
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe12.iad.POSTED!83aa503d!not-for-mail |
|---|---|
| From | Daniel Pitts <newsgroup.nospam@virtualinfinity.net> |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: exporting a HashMap |
| References | <ljv5h7pl5t57ikpoqntvu1iif4tkrl9l7t@4ax.com> |
| In-Reply-To | <ljv5h7pl5t57ikpoqntvu1iif4tkrl9l7t@4ax.com> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Lines | 13 |
| Message-ID | <SbOQq.445$DC7.289@newsfe12.iad> (permalink) |
| X-Complaints-To | abuse@newsrazor.net |
| NNTP-Posting-Date | Mon, 16 Jan 2012 05:02:42 UTC |
| Date | Sun, 15 Jan 2012 21:02:40 -0800 |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:11371 |
Show key headers only | View raw
On 1/15/12 8:30 AM, 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. Uh, TreeMap is in key order. Why would you use HashMap if you want key order?
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Find similar | Unroll 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