68 lines
2.0 KiB
Java
68 lines
2.0 KiB
Java
package com.google.common.collect;
|
|
|
|
import java.io.Serializable;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes2.dex */
|
|
public final class NullsFirstOrdering<T> extends Ordering<T> implements Serializable {
|
|
private static final long serialVersionUID = 0;
|
|
final Ordering<? super T> ordering;
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <S extends T> Ordering<S> nullsFirst() {
|
|
return this;
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public NullsFirstOrdering(Ordering<? super T> ordering) {
|
|
this.ordering = ordering;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public final int compare(T t, T t2) {
|
|
if (t == t2) {
|
|
return 0;
|
|
}
|
|
if (t == null) {
|
|
return -1;
|
|
}
|
|
if (t2 == null) {
|
|
return 1;
|
|
}
|
|
return this.ordering.compare(t, t2);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <S extends T> Ordering<S> reverse() {
|
|
return this.ordering.reverse().nullsLast();
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering
|
|
public final <S extends T> Ordering<S> nullsLast() {
|
|
return this.ordering.nullsLast();
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public final boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (obj instanceof NullsFirstOrdering) {
|
|
return this.ordering.equals(((NullsFirstOrdering) obj).ordering);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
return this.ordering.hashCode() ^ 957692532;
|
|
}
|
|
|
|
public final String toString() {
|
|
String valueOf = String.valueOf(this.ordering);
|
|
StringBuilder sb = new StringBuilder(String.valueOf(valueOf).length() + 13);
|
|
sb.append(valueOf);
|
|
sb.append(".nullsFirst()");
|
|
return sb.toString();
|
|
}
|
|
}
|