|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
@Beta @GwtCompatible public interface Equivalence<T>
A strategy for determining whether two instances are considered equivalent. Examples of
equivalences are the identity equivalence and equals equivalence.
| Method Summary | |
|---|---|
boolean |
equivalent(T a,
T b)
Returns true if the given objects are considered equivalent. |
int |
hash(T t)
Returns a hash code for object. |
| Method Detail |
|---|
boolean equivalent(@Nullable
T a,
@Nullable
T b)
true if the given objects are considered equivalent.
The equivalent method implements an equivalence relation on object references:
x, including null, equivalent(x, x) should return true.
x and y, equivalent(x, y) == equivalent(y, x).
x, y, and z, if
equivalent(x, y) returns true and equivalent(y, z) returns true, then equivalent(x, z) should return true.
x and y, multiple invocations
of equivalent(x, y) consistently return true or consistently return false (provided that neither x nor y is modified).
int hash(@Nullable
T t)
object. This function must return the same value for
any two references which are equivalent(T, T), and should as often as possible return a
distinct value for references which are not equivalent. It should support null references.
the same contractual obligations apply here
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||