81 lines
2.6 KiB
Java
81 lines
2.6 KiB
Java
package d0.u;
|
|
|
|
import d0.z.d.m;
|
|
import java.util.Comparator;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: Comparisons.kt */
|
|
public class a {
|
|
|
|
/* compiled from: Comparisons.kt */
|
|
/* renamed from: d0.u.a$a reason: collision with other inner class name */
|
|
public static final class C0295a<T> implements Comparator<T> {
|
|
public final /* synthetic */ Function1[] i;
|
|
|
|
public C0295a(Function1[] function1Arr) {
|
|
this.i = function1Arr;
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public final int compare(T t, T t2) {
|
|
return a.access$compareValuesByImpl(t, t2, this.i);
|
|
}
|
|
}
|
|
|
|
/* compiled from: Comparisons.kt */
|
|
public static final class b<T> implements Comparator<T> {
|
|
public final /* synthetic */ Comparator i;
|
|
public final /* synthetic */ Comparator j;
|
|
|
|
public b(Comparator comparator, Comparator comparator2) {
|
|
this.i = comparator;
|
|
this.j = comparator2;
|
|
}
|
|
|
|
@Override // java.util.Comparator
|
|
public final int compare(T t, T t2) {
|
|
int compare = this.i.compare(t, t2);
|
|
return compare != 0 ? compare : this.j.compare(t, t2);
|
|
}
|
|
}
|
|
|
|
public static final int access$compareValuesByImpl(Object obj, Object obj2, Function1[] function1Arr) {
|
|
for (Function1 function1 : function1Arr) {
|
|
int compareValues = compareValues((Comparable) function1.invoke(obj), (Comparable) function1.invoke(obj2));
|
|
if (compareValues != 0) {
|
|
return compareValues;
|
|
}
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
public static final <T> Comparator<T> compareBy(Function1<? super T, ? extends Comparable<?>>... function1Arr) {
|
|
m.checkNotNullParameter(function1Arr, "selectors");
|
|
if (function1Arr.length > 0) {
|
|
return new C0295a(function1Arr);
|
|
}
|
|
throw new IllegalArgumentException("Failed requirement.".toString());
|
|
}
|
|
|
|
public static final <T extends Comparable<?>> int compareValues(T t, T t2) {
|
|
if (t == t2) {
|
|
return 0;
|
|
}
|
|
if (t == null) {
|
|
return -1;
|
|
}
|
|
if (t2 == null) {
|
|
return 1;
|
|
}
|
|
return t.compareTo(t2);
|
|
}
|
|
|
|
public static final <T extends Comparable<? super T>> Comparator<T> naturalOrder() {
|
|
return c.i;
|
|
}
|
|
|
|
public static final <T> Comparator<T> then(Comparator<T> comparator, Comparator<? super T> comparator2) {
|
|
m.checkNotNullParameter(comparator, "$this$then");
|
|
m.checkNotNullParameter(comparator2, "comparator");
|
|
return new b(comparator, comparator2);
|
|
}
|
|
}
|