mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
54 lines
1.8 KiB
Java
54 lines
1.8 KiB
Java
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<T> extends Ordering<Iterable<T>> implements Serializable {
|
|
private static final long serialVersionUID = 0;
|
|
final Comparator<? super T> elementOrder;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public LexicographicalOrdering(Comparator<? super T> comparator) {
|
|
this.elementOrder = comparator;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public int compare(Iterable<T> iterable, Iterable<T> iterable2) {
|
|
Iterator<T> it = iterable.iterator();
|
|
Iterator<T> 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();
|
|
}
|
|
}
|