40 lines
992 B
Java
40 lines
992 B
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.Serializable;
|
|
import java.util.Comparator;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class ComparatorOrdering<T> extends Ordering<T> implements Serializable {
|
|
final Comparator<T> a;
|
|
|
|
ComparatorOrdering(Comparator<T> comparator) {
|
|
Preconditions.a(comparator);
|
|
this.a = comparator;
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public int compare(T t, T t2) {
|
|
return this.a.compare(t, t2);
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public boolean equals(Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (obj instanceof ComparatorOrdering) {
|
|
return this.a.equals(((ComparatorOrdering) obj).a);
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return this.a.hashCode();
|
|
}
|
|
|
|
public String toString() {
|
|
return this.a.toString();
|
|
}
|
|
}
|