Rabbit-R1/android (non root)/java/sources/com/google/common/collect/ComparatorOrdering.java
2024-05-21 17:08:36 -04:00

43 lines
1.4 KiB
Java

package com.google.common.collect;
import com.google.common.base.Preconditions;
import java.io.Serializable;
import java.util.Comparator;
import javax.annotation.CheckForNull;
/* JADX INFO: Access modifiers changed from: package-private */
@ElementTypesAreNonnullByDefault
/* loaded from: classes3.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 int compare(@ParametricNullness T t, @ParametricNullness T t2) {
return this.comparator.compare(t, t2);
}
@Override // java.util.Comparator
public boolean equals(@CheckForNull Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ComparatorOrdering) {
return this.comparator.equals(((ComparatorOrdering) obj).comparator);
}
return false;
}
public int hashCode() {
return this.comparator.hashCode();
}
public String toString() {
return this.comparator.toString();
}
}