77 lines
2.5 KiB
Java
77 lines
2.5 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.Serializable;
|
|
import java.util.Iterator;
|
|
|
|
/* loaded from: classes2.dex */
|
|
final class ReverseNaturalOrdering extends Ordering<Comparable> implements Serializable {
|
|
static final ReverseNaturalOrdering INSTANCE = new ReverseNaturalOrdering();
|
|
private static final long serialVersionUID = 0;
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public final int compare(Comparable comparable, Comparable comparable2) {
|
|
Preconditions.checkNotNull(comparable);
|
|
if (comparable == comparable2) {
|
|
return 0;
|
|
}
|
|
return comparable2.compareTo(comparable);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <S extends Comparable> Ordering<S> reverse() {
|
|
return Ordering.natural();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E min(E e, E e2) {
|
|
return (E) NaturalOrdering.INSTANCE.max(e, e2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E min(E e, E e2, E e3, E... eArr) {
|
|
return (E) NaturalOrdering.INSTANCE.max(e, e2, e3, eArr);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E min(Iterator<E> it) {
|
|
return (E) NaturalOrdering.INSTANCE.max(it);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E min(Iterable<E> iterable) {
|
|
return (E) NaturalOrdering.INSTANCE.max(iterable);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E max(E e, E e2) {
|
|
return (E) NaturalOrdering.INSTANCE.min(e, e2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E max(E e, E e2, E e3, E... eArr) {
|
|
return (E) NaturalOrdering.INSTANCE.min(e, e2, e3, eArr);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E max(Iterator<E> it) {
|
|
return (E) NaturalOrdering.INSTANCE.min(it);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <E extends Comparable> E max(Iterable<E> iterable) {
|
|
return (E) NaturalOrdering.INSTANCE.min(iterable);
|
|
}
|
|
|
|
private ReverseNaturalOrdering() {
|
|
}
|
|
|
|
public final String toString() {
|
|
return "Ordering.natural().reverse()";
|
|
}
|
|
|
|
private Object readResolve() {
|
|
return INSTANCE;
|
|
}
|
|
}
|