59 lines
2.0 KiB
Java
59 lines
2.0 KiB
Java
package com.google.common.base;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.Iterator;
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class PairwiseEquivalence<T> extends Equivalence<Iterable<T>> implements Serializable {
|
|
private static final long serialVersionUID = 1;
|
|
final Equivalence<? super T> elementEquivalence;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public PairwiseEquivalence(Equivalence<? super T> equivalence) {
|
|
this.elementEquivalence = (Equivalence) Preconditions.checkNotNull(equivalence);
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.base.Equivalence
|
|
public final boolean doEquivalent(Iterable<T> iterable, Iterable<T> iterable2) {
|
|
Iterator<T> it = iterable.iterator();
|
|
Iterator<T> it2 = iterable2.iterator();
|
|
while (it.hasNext() && it2.hasNext()) {
|
|
if (!this.elementEquivalence.equivalent(it.next(), it2.next())) {
|
|
return false;
|
|
}
|
|
}
|
|
return (it.hasNext() || it2.hasNext()) ? false : true;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: protected */
|
|
@Override // com.google.common.base.Equivalence
|
|
public final int doHash(Iterable<T> iterable) {
|
|
Iterator<T> it = iterable.iterator();
|
|
int i = 78721;
|
|
while (it.hasNext()) {
|
|
i = (i * 24943) + this.elementEquivalence.hash(it.next());
|
|
}
|
|
return i;
|
|
}
|
|
|
|
public final boolean equals(Object obj) {
|
|
if (obj instanceof PairwiseEquivalence) {
|
|
return this.elementEquivalence.equals(((PairwiseEquivalence) obj).elementEquivalence);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return this.elementEquivalence.hashCode() ^ 1185147655;
|
|
}
|
|
|
|
public final String toString() {
|
|
String valueOf = String.valueOf(this.elementEquivalence);
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 11);
|
|
sb.append(valueOf);
|
|
sb.append(".pairwise()");
|
|
return sb.toString();
|
|
}
|
|
}
|