Re: Error message I can't figure out
Joshua Cranmer wrote:
On 02/25/2010 09:01 PM, Roedy Green wrote:
On Thu, 25 Feb 2010 18:08:56 -0500, Joshua Cranmer
<Pidgeot18@verizon.invalid> 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.
It is a STATIC nested class, so you don't have THAT complication.
Not according to my installation:
$ javap -private java.util.TreeMap\$Values
Compiled from "TreeMap.java"
class java.util.TreeMap$Values extends java.util.AbstractCollection{
final java.util.TreeMap this$0;
[ The signature of a non-static class ]
Or, if you want the source code itself:
class Values extends AbstractCollection<V> {
I don't see no static there :-)
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 .
1. Not that large a distinction, obviously.