package com.google.common.collect; import java.io.Serializable; import java.util.Comparator; import java.util.Iterator; import javax.annotation.CheckForNull; @ElementTypesAreNonnullByDefault /* loaded from: classes3.dex */ final class LexicographicalOrdering extends Ordering> implements Serializable { private static final long serialVersionUID = 0; final Comparator elementOrder; /* JADX INFO: Access modifiers changed from: package-private */ public LexicographicalOrdering(Comparator comparator) { this.elementOrder = comparator; } @Override // com.google.common.collect.Ordering, java.util.Comparator public int compare(Iterable iterable, Iterable iterable2) { Iterator it = iterable.iterator(); Iterator it2 = iterable2.iterator(); while (it.hasNext()) { if (!it2.hasNext()) { return 1; } int compare = this.elementOrder.compare(it.next(), it2.next()); if (compare != 0) { return compare; } } return it2.hasNext() ? -1 : 0; } @Override // java.util.Comparator public boolean equals(@CheckForNull Object obj) { if (obj == this) { return true; } if (obj instanceof LexicographicalOrdering) { return this.elementOrder.equals(((LexicographicalOrdering) obj).elementOrder); } return false; } public int hashCode() { return this.elementOrder.hashCode() ^ 2075626741; } public String toString() { String valueOf = String.valueOf(this.elementOrder); return new StringBuilder(String.valueOf(valueOf).length() + 18).append(valueOf).append(".lexicographical()").toString(); } }