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


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

Re: Glitch in Java Collections (No descendingMap in LinkedHashMap)

Path csiph.com!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail
From Jan Burse <janburse@fastmail.fm>
Newsgroups comp.lang.java.programmer
Subject Re: Glitch in Java Collections (No descendingMap in LinkedHashMap)
Date Fri, 05 Oct 2012 23:44:43 +0200
Organization albasani.net
Lines 38
Message-ID <k4nkc4$fkr$1@news.albasani.net> (permalink)
References <k4jua8$77d$1@news.albasani.net> <ad6bpvFcuttU1@mid.individual.net> <0fca6c33-cce6-410e-a8c9-cf503969a9ff@googlegroups.com> <ad8im6FsiqpU1@mid.individual.net> <8603e8f1-5c24-432a-b42a-540b44f8c577@googlegroups.com> <KcGbs.5480$w_2.2339@newsfe12.iad> <25cc28d0-4f77-42de-974c-2f699519c166@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace news.albasani.net VZUnF+j4TLKhytfDh+IxVBJvPgTUNmHaUC8iil8aeTaoU7WrCPhDT6wO3uqMv+xu5kHsHwImtpVWY8n0URm2FuydNRnPV1qHSm+i/FvYenEiHi4elA6czXqC4JDonSr8
NNTP-Posting-Date Fri, 5 Oct 2012 21:44:36 +0000 (UTC)
Injection-Info news.albasani.net; logging-data="OzXsSb7di65Ir9Z/wxqx3KSJHV5AZ4NHFJtSDp13a5tReItyOx501uW5wW9Kb4+zM8f4Dy89Pyxs9WvlJIA2b7SnmmuFobcWj7JRjZ2MIjF01aFK/ekIkvOsfgaH1lDp"; mail-complaints-to="abuse@albasani.net"
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120909 Firefox/15.0.1 SeaMonkey/2.12.1
In-Reply-To <25cc28d0-4f77-42de-974c-2f699519c166@googlegroups.com>
Cancel-Lock sha1:dCY5OFQlRYQRQfAorYCfyO5kZC4=
Xref csiph.com comp.lang.java.programmer:19150

Show key headers only | View raw


Lew schrieb:
> Again, my concern is that 'Set' doesn't promise predictable iteration order, in fact,
> exactly the opposite. The only iterators available for a 'Map' are through its 'Set'-
> returning methods, which result in a collection that promises not to have a predictable
> iteration order.

Well that is not fully correct. When you get a keySet, entrySet or
valueSet, you indeed get an object that is derived from the class
Set. And this class in itself has indeed no guarantee.

The key for understanding what guarantees are around, is looking at
the interface which provides the keySet, entrySet or valueSet. For
example when the entrySet comes from SortedMap, then we have the
following javadoc:

public interface SortedMap<K,V> extends Map<K,V> {

     /**
      * Returns a {@link Set} view of the mappings contained in this map.
      * The set's iterator returns the entries in ascending key order.
     ...
      */
     Set<Map.Entry<K, V>> entrySet();

Do you see the mention of ascending key order above?

But LinkedHashMap does not implement this interface as I mentioned
in my initial post. And HashMap, the super class, has no guarantee.
So this is probably a Java glitch.

But I was not aspiring in detecting this glitch. I am more interested
in the reverse iterator. Any route to get at a reverse iterator?

Bye



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


Thread

Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-04 14:09 +0200
  Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Robert Klemme <shortcutter@googlemail.com> - 2012-10-04 23:01 +0200
    Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Lew <lewbloch@gmail.com> - 2012-10-04 14:43 -0700
      Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-05 00:17 +0200
      Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Robert Klemme <shortcutter@googlemail.com> - 2012-10-05 19:11 +0200
        Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Lew <lewbloch@gmail.com> - 2012-10-05 11:05 -0700
          Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-05 20:18 +0200
          Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-10-05 12:06 -0700
            Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Lew <lewbloch@gmail.com> - 2012-10-05 13:04 -0700
              Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-05 23:44 +0200
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-05 23:50 +0200
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-06 00:00 +0200
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) glen herrmannsfeldt <gah@ugcs.caltech.edu> - 2012-10-05 23:39 +0000
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-06 12:18 +0200
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-06 12:22 +0200
              Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-10-05 15:51 -0700
          Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Robert Klemme <shortcutter@googlemail.com> - 2012-10-06 13:53 +0200
  Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-09 14:16 -0600
    Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-10 09:00 -0600
      Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-10 11:34 -0400
        Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-10 10:28 -0600
          Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-10 11:45 -0600
            Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Lew <lewbloch@gmail.com> - 2012-10-10 10:52 -0700
              Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-10 12:47 -0600
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-11 14:17 -0600
            Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-10 18:20 -0400
              Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-10 16:51 -0600
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-12 14:34 +0200
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jim Janney <jjanney@shell.xmission.com> - 2012-10-12 09:12 -0600
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Eric Sosman <esosman@comcast-dot-net.invalid> - 2012-10-12 11:42 -0400
                Re: Glitch in Java Collections (No descendingMap in LinkedHashMap) Jan Burse <janburse@fastmail.fm> - 2012-10-12 21:02 +0200

csiph-web