The documentation for 'SortedMap' and 'TreeMap' very distinctly warns
that the implementations use 'compare' and 'compareTo' instead of
'equals', and very strongly advise that one keep the methods
consistent.
the equals() uses a compareTo() internally, that would be against the
key:
That does not pertain to what I'm saying. I'm discussing the use of
'compareTo' instead of 'equals', not by 'equals'.
@Override
public boolean equals( Object key )
{
return ivKey.equals( ((PersonMapKey) key).getKey() );
}
That's all well and good, but your 'equals' is not consistent with
your implementation of 'compareTo', and therefore could raise trouble
for SortedMap implementations, according to the Javadocs.