mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
64 lines
2 KiB
Java
64 lines
2 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.Serializable;
|
|
import javax.annotation.CheckForNull;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
public final class NaturalOrdering extends Ordering<Comparable<?>> implements Serializable {
|
|
static final NaturalOrdering INSTANCE = new NaturalOrdering();
|
|
private static final long serialVersionUID = 0;
|
|
|
|
@CheckForNull
|
|
private transient Ordering<Comparable<?>> nullsFirst;
|
|
|
|
@CheckForNull
|
|
private transient Ordering<Comparable<?>> nullsLast;
|
|
|
|
private Object readResolve() {
|
|
return INSTANCE;
|
|
}
|
|
|
|
public String toString() {
|
|
return "Ordering.natural()";
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public int compare(Comparable<?> comparable, Comparable<?> comparable2) {
|
|
Preconditions.checkNotNull(comparable);
|
|
Preconditions.checkNotNull(comparable2);
|
|
return comparable.compareTo(comparable2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public <S extends Comparable<?>> Ordering<S> nullsFirst() {
|
|
Ordering<S> ordering = (Ordering<S>) this.nullsFirst;
|
|
if (ordering != null) {
|
|
return ordering;
|
|
}
|
|
Ordering<S> nullsFirst = super.nullsFirst();
|
|
this.nullsFirst = nullsFirst;
|
|
return nullsFirst;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public <S extends Comparable<?>> Ordering<S> nullsLast() {
|
|
Ordering<S> ordering = (Ordering<S>) this.nullsLast;
|
|
if (ordering != null) {
|
|
return ordering;
|
|
}
|
|
Ordering<S> nullsLast = super.nullsLast();
|
|
this.nullsLast = nullsLast;
|
|
return nullsLast;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public <S extends Comparable<?>> Ordering<S> reverse() {
|
|
return ReverseNaturalOrdering.INSTANCE;
|
|
}
|
|
|
|
private NaturalOrdering() {
|
|
}
|
|
}
|