mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2025-01-09 13:43:22 +00:00
49 lines
2 KiB
Java
49 lines
2 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Function;
|
|
import com.google.common.base.Objects;
|
|
import com.google.common.base.Preconditions;
|
|
import java.io.Serializable;
|
|
import javax.annotation.CheckForNull;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
@ElementTypesAreNonnullByDefault
|
|
/* loaded from: classes3.dex */
|
|
public final class ByFunctionOrdering<F, T> extends Ordering<F> implements Serializable {
|
|
private static final long serialVersionUID = 0;
|
|
final Function<F, ? extends T> function;
|
|
final Ordering<T> ordering;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public ByFunctionOrdering(Function<F, ? extends T> function, Ordering<T> ordering) {
|
|
this.function = (Function) Preconditions.checkNotNull(function);
|
|
this.ordering = (Ordering) Preconditions.checkNotNull(ordering);
|
|
}
|
|
|
|
@Override // com.google.common.collect.Ordering, java.util.Comparator
|
|
public int compare(@ParametricNullness F f, @ParametricNullness F f2) {
|
|
return this.ordering.compare(this.function.apply(f), this.function.apply(f2));
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public boolean equals(@CheckForNull Object obj) {
|
|
if (obj == this) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof ByFunctionOrdering)) {
|
|
return false;
|
|
}
|
|
ByFunctionOrdering byFunctionOrdering = (ByFunctionOrdering) obj;
|
|
return this.function.equals(byFunctionOrdering.function) && this.ordering.equals(byFunctionOrdering.ordering);
|
|
}
|
|
|
|
public int hashCode() {
|
|
return Objects.hashCode(this.function, this.ordering);
|
|
}
|
|
|
|
public String toString() {
|
|
String valueOf = String.valueOf(this.ordering);
|
|
String valueOf2 = String.valueOf(this.function);
|
|
return new StringBuilder(String.valueOf(valueOf).length() + 13 + String.valueOf(valueOf2).length()).append(valueOf).append(".onResultOf(").append(valueOf2).append(")").toString();
|
|
}
|
|
}
|