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

Method equals

corpus/java/training/guava/base/Equivalence.java:195–214  ·  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

193 * equivalence.
194 */
195 @Override
196 public boolean equals(@Nullable Object obj) {
197 if (obj == this) {
198 return true;
199 }
200 if (obj instanceof Wrapper) {
201 Wrapper<?> that = (Wrapper<?>) obj; // note: not necessarily a Wrapper<T>
202
203 if (this.equivalence.equals(that.equivalence)) {
204 /*
205 * We'll accept that as sufficient "proof" that either equivalence should be able to
206 * handle either reference, so it's safe to circumvent compile-time type checking.
207 */
208 @SuppressWarnings("unchecked")
209 Equivalence<Object> equivalence = (Equivalence<Object>) this.equivalence;
210 return equivalence.equivalent(this.reference, that.reference);
211 }
212 }
213 return false;
214 }
215
216 /**
217 * 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