• Post Reply Bookmark Topic Watch Topic
  • New Topic

Comparable  RSS feed

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I implement the interface Comparable, why do I have to override public boolean equals(Object o) ???

It does not seem to be called from public int compareTo(T o).

So who is calling it and why?

 
Rob Spoor
Sheriff
Posts: 21095
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to override equals, as is said on the Javadoc page of java.util.Comparator. Read its full text and everything should be clear.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!