package com.google.common.collect; import java.io.Serializable; import java.util.Comparator; import java.util.Iterator; /* loaded from: classes2.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 final 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 final boolean equals(Object obj) { if (obj == this) { return true; } if (obj instanceof LexicographicalOrdering) { return this.elementOrder.equals(((LexicographicalOrdering) obj).elementOrder); } return false; } public final int hashCode() { return this.elementOrder.hashCode() ^ 2075626741; } public final String toString() { String valueOf = String.valueOf(this.elementOrder); StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 18); sb.append(valueOf); sb.append(".lexicographical()"); return sb.toString(); } }