what-the-bank/sources/com/google/common/collect/ComparatorOrdering.java

42 lines
1.3 KiB
Java

package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Comparator;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class ComparatorOrdering<T> extends Ordering<T> implements Serializable {
private static final long serialVersionUID = 0;
final Comparator<T> comparator;
/* JADX INFO: Access modifiers changed from: package-private */
public ComparatorOrdering(Comparator<T> comparator) {
this.comparator = (Comparator) Preconditions.checkNotNull(comparator);
}
@Override // com.google.common.collect.Ordering, java.util.Comparator
public final int compare(T t, T t2) {
return this.comparator.compare(t, t2);
}
@Override // java.util.Comparator
public final boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ComparatorOrdering) {
return this.comparator.equals(((ComparatorOrdering) obj).comparator);
}
return false;
}
public final int hashCode() {
return this.comparator.hashCode();
}
public final String toString() {
return this.comparator.toString();
}
}