CompareTo may return 0, alternative to TreeSet/TreeMap
Posted
by Bart van Heukelom
on Stack Overflow
See other posts from Stack Overflow
or by Bart van Heukelom
Published on 2010-06-14T20:46:48Z
Indexed on
2010/06/14
20:52 UTC
Read the original article
Hit count: 287
I need a sorted set of objects and am currently using the TreeSet
. My problem is that the compareTo
of the objects will often return 0
, meaning the order of those two objects is to be left unchanged. TreeMap
(used by TreeSet
by default) will then regard them as the same object, which is not true.
What alternative to TreeMap
can I use?
© Stack Overflow or respective owner