>
> java.util.SortedSet clonedSet = new TreeSet();
>
> This looks to me as though it should read:
>
> java.util.SortedSet clonedSet = new TreeSet(comparator);
>
> ...which fixes the problem for me. There's an equivalent line
> in SortedMap which I expect suffers from the same problem.
Ah. Yeah, actually the "clonedSet" is used only as a snapshot and
we dont care about the sorted order of the snapshot - so we wouldn't
really need the comparator, except if the elements don't implement
Comparable at all.
I can think of two different fixes:
(1) Your suggestion.
(2) just comment out SortedMap.copy() and SortedSet.copy()
and use the implementations from the superclasses Map and Set.
Looking at the way the snapshots are used, we don't need the copy
to belong to the subclass.....
> I won't make this my first change in CVS, since I haven't attempted
> to understand the SortedSet logic in any detail, and for all I know
> this change could affect something else.
Feel welcome to commit either of those fixes .... otherwise I will
do it this evening.
Thanks (once again)
Gavin
|