Prev: UDF-8 Reading for URL - not working
Next: Java Swing Question: Robot Screenshot does odd things when close to the mouse cursor
From: Lew on 26 Feb 2010 21:51 Joshua Cranmer wrote, quoted or indirectly quoted someone who said : >> The value set class (and those for the key and entry sets, FWIW) is >> defined as an inner class. Therefore, all of its constructors implicitly >> have an argument of TreeMap, which makes making the Serializable a >> little more problematic. Roedy Green wrote: > It is a STATIC nested class, so you don't have THAT complication. Well, you sort of do, in that the 'values()' set is backed by the Map and changes to each affect the other. You don't have a 'values()' set instance unless you have the Map instance. -- Lew
From: Roedy Green on 26 Feb 2010 23:51
On Fri, 26 Feb 2010 12:13:44 -0800, "Mike Schilling" <mscottschilling(a)hotmail.com> wrote, quoted or indirectly quoted someone who said : > >Since it's purpose is to be a view into a TreeMap, it would either need to >be a non-static class of have a field of type TreeMap that pointed to its >parent. [1]. Also, since its purpose is to be a view into a TreeMap, it >would be a weird thing to serialize: If it were deserialized without its >parent TreeMap, what good would it be? And if you're going to deserialize >the TreeMap, you can just call values() on that If you could make changes to the extracted list that reflect back on the original collection, serializing would be pretty weird. TreeMap.KeySet is a static class static final class KeySet<E> extends AbstractSet<E> implements NavigableSet<E> oddly TreeMap.Values is NOT. class Values extends AbstractCollection<V> -- Roedy Green Canadian Mind Products http://mindprod.com The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair. ~ Douglas Adams (born: 1952-03-11 died: 2001-05-11 at age: 49) |