MCPcopy Create free account
hub / github.com/antlr/codebuff / equals

Method equals

output/java_guava/1.4.16/Equivalence.java:213–231  ·  view source on GitHub ↗

Returns true if Equivalence#equivalent(Object, Object) applied to the wrapped references is true and both wrappers use the Object#equals(Object) same equivalence.

(@Nullable Object obj)

Source from the content-addressed store, hash-verified

211 */
212
213 @Override
214 public boolean equals(@Nullable Object obj) {
215 if (obj == this) {
216 return true;
217 }
218 if (obj instanceof Wrapper) {
219 Wrapper<?> that = (Wrapper<?>) obj; // note: not necessarily a Wrapper<T>
220 if (this.equivalence.equals(that.equivalence)) {
221 /*
222 * We'll accept that as sufficient "proof" that either equivalence should be able to
223 * handle either reference, so it's safe to circumvent compile-time type checking.
224 */
225 @SuppressWarnings("unchecked")
226 Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence;
227 return equivalence.equivalent(this.reference, that.reference);
228 }
229 }
230 return false;
231 }
232
233 /**
234 * Returns the result of {@link Equivalence#hash(Object)} applied to the wrapped reference.

Callers

nothing calls this directly

Calls 2

equalsMethod · 0.65
equivalentMethod · 0.45

Tested by

no test coverage detected