RFR: 8261123: Augment discussion of equivalence classes in Object.equals and comparison methods [v3]
Stuart Marks
smarks at openjdk.java.net
Fri Feb 12 23:33:44 UTC 2021
On Fri, 12 Feb 2021 22:12:30 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/Comparable.java line 90:
>>
>>> 88: * of the {@code equals} method and the equivalence classes defined by
>>> 89: * the quotient of the {@code compareTo} method are the same.
>>> 90: *
>>
>> I think in both cases it should be "the equivalence class defined by...." That is, "equivalence class" should be singular. But there are two of them, so the sentence still properly concludes "... are the same."
>
> An equivalence relation defines a *set* of equivalence classes which partition the objects the relation operates on. For example, the "same signum value" equivalence relation on integers has three equivalence classes :
> 1) negative nonzero numbers (corresponding to signum == -1)
> 2) zero (corresponding to signum = 0)
> 3) positive nonzero numbers (corresponding to signum ==1)
OK, got it.
-------------
PR: https://git.openjdk.java.net/jdk/pull/2471
More information about the core-libs-dev
mailing list