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 extends Ordering implements Serializable { private static final long serialVersionUID = 0; final Function function; final Ordering ordering; /* JADX INFO: Access modifiers changed from: package-private */ public ByFunctionOrdering(Function function, Ordering 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(); } }