EN
Java - Do I need to implement equals and hash code in treemap?
1 answers
6 points
Java - Do I need to implement equals and hash code in treemap?
1 answer
3 points
No, you don't.
We don't need to implement equals and hashCode in key object used in TreeMap or HashSet.
TreeMap and HashSet in java works by comparing objets (that's why we have sorted order). If the key is the same than the value is overrided by new value.
Here is entire post about this topic:
0 commentsShow commentsAdd comment