Can someone explain to me if there is a difference in the codes below when comparing objects and, more specifically, their values.
Code 1
x.equals(y)
Code 2
x.compareTo(y) == 0
Are the codes above interchangeable. What is the difference, if any?
source
share