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

Method equals

output/java_guava/1.4.13/Equivalence.java:212–230  ·  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

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