Rabbit-R1/original r1/java/sources/kotlin/collections/GroupingKt__GroupingKt.java

175 lines
17 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package kotlin.collections;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.exifinterface.media.ExifInterface;
import defpackage.DeviceControl$Companion$$ExternalSyntheticLambda3;
import defpackage.DeviceControl$Companion$$ExternalSyntheticLambda4;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import kotlin.Metadata;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.functions.Function3;
import kotlin.jvm.functions.Function4;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: Grouping.kt */
@Metadata(d1 = {"\u0000@\n\u0000\n\u0002\u0010$\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\u0004\n\u0002\u0010\u000b\n\u0002\b\u0003\n\u0002\u0010%\n\u0002\b\u0003\n\u0002\u0010\b\n\u0002\b\u0003\n\u0002\u0018\u0002\n\u0002\u0018\u0002\n\u0002\b\n\u001a\u009e\u0001\u0010\u0000\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u00030\u0001\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0004\b\u0002\u0010\u0003*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u00052b\u0010\u0006\u001a^\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0015\u0012\u0013\u0018\u0001H\u0003¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0013\u0012\u00110\\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000e\u0012\u0004\u0012\u0002H\u00030\u0007H\u0087\\u0001\u0000\u001a·\u0001\u0010\u000f\u001a\u0002H\u0010\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0004\b\u0002\u0010\u0003\"\u0016\b\u0003\u0010\u0010*\u0010\u0012\u0006\b\u0000\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u00030\u0011*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u00052\u0006\u0010\u0012\u001a\u0002H\u00102b\u0010\u0006\u001a^\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0015\u0012\u0013\u0018\u0001H\u0003¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0013\u0012\u00110\\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000e\u0012\u0004\u0012\u0002H\u00030\u0007H\u0087\\u0001\u0000¢\u0006\u0002\u0010\u0013\u001aI\u0010\u0014\u001a\u0002H\u0010\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0016\b\u0002\u0010\u0010*\u0010\u0012\u0006\b\u0000\u0012\u0002H\u0002\u0012\u0004\u0012\u00020\u00150\u0011*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u00052\u0006\u0010\u0012\u001a\u0002H\u0010H\u0007¢\u0006\u0002\u0010\u0016\u001a¿\u0001\u0010\u0017\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u00030\u0001\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0004\b\u0002\u0010\u0003*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u000526\u0010\u0018\u001a2\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0004\u0012\u0002H\u00030\u00192K\u0010\u0006\u001aG\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0013\u0012\u0011H\u0003¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0004\u0012\u0002H\u00030\u001aH\u0087\\u0001\u0000\u001a\u007f\u0010\u0017\u001a\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u00030\u0001\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0004\b\u0002\u0010\u0003*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u00052\u0006\u0010\u001b\u001a\u0002H\u000326\u0010\u0006\u001a2\u0012\u0013\u0012\u0011H\u0003¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\u000b\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0004\u0012\u0002H\u00030\u0019H\u0087\\u0001\u0000¢\u0006\u0002\u0010\u001c\u001aØ\u0001\u0010\u001d\u001a\u0002H\u0010\"\u0004\b\u0000\u0010\u0004\"\u0004\b\u0001\u0010\u0002\"\u0004\b\u0002\u0010\u0003\"\u0016\b\u0003\u0010\u0010*\u0010\u0012\u0006\b\u0000\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u00030\u0011*\u000e\u0012\u0004\u0012\u0002H\u0004\u0012\u0004\u0012\u0002H\u00020\u00052\u0006\u0010\u0012\u001a\u0002H\u001026\u0010\u0018\u001a2\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\n\u0012\u0013\u0012\u0011H\u0004¢\u0006\f\b\b\u0012\b\b\t\u0012\u0004\b\b(\f\u0012\u0004\u0012\u0002H\u00030\u00192K\u0010\u0006\u001aG\u0012\u0013\u0012\u0011H\u0002¢\u0006\f\
/* loaded from: classes3.dex */
class GroupingKt__GroupingKt extends GroupingKt__GroupingJVMKt {
/* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object] */
public static final <T, K, R> Map<K, R> aggregate(Grouping<T, ? extends K> grouping, Function4<? super K, ? super R, ? super T, ? super Boolean, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(operation, "operation");
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
Object keyOf = grouping.keyOf(next);
DeviceControl$Companion$$ExternalSyntheticLambda3 deviceControl$Companion$$ExternalSyntheticLambda3 = (Object) linkedHashMap.get(keyOf);
linkedHashMap.put(keyOf, operation.invoke(keyOf, deviceControl$Companion$$ExternalSyntheticLambda3, next, Boolean.valueOf(deviceControl$Companion$$ExternalSyntheticLambda3 == null && !linkedHashMap.containsKey(keyOf))));
}
return linkedHashMap;
}
/* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object] */
public static final <T, K, R, M extends Map<? super K, R>> M aggregateTo(Grouping<T, ? extends K> grouping, M destination, Function4<? super K, ? super R, ? super T, ? super Boolean, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(destination, "destination");
Intrinsics.checkNotNullParameter(operation, "operation");
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
Object keyOf = grouping.keyOf(next);
DeviceControl$Companion$$ExternalSyntheticLambda3 deviceControl$Companion$$ExternalSyntheticLambda3 = (Object) destination.get(keyOf);
destination.put(keyOf, operation.invoke(keyOf, deviceControl$Companion$$ExternalSyntheticLambda3, next, Boolean.valueOf(deviceControl$Companion$$ExternalSyntheticLambda3 == null && !destination.containsKey(keyOf))));
}
return destination;
}
public static final <T, K, M extends Map<? super K, Integer>> M eachCountTo(Grouping<T, ? extends K> grouping, M destination) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(destination, "destination");
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
K keyOf = grouping.keyOf(sourceIterator.next());
Object obj = destination.get(keyOf);
if (obj == null && !destination.containsKey(keyOf)) {
obj = 0;
}
destination.put(keyOf, Integer.valueOf(((Number) obj).intValue() + 1));
}
return destination;
}
/* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object] */
public static final <T, K, R> Map<K, R> fold(Grouping<T, ? extends K> grouping, Function2<? super K, ? super T, ? extends R> initialValueSelector, Function3<? super K, ? super R, ? super T, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(initialValueSelector, "initialValueSelector");
Intrinsics.checkNotNullParameter(operation, "operation");
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
Object keyOf = grouping.keyOf(next);
R r = (Object) linkedHashMap.get(keyOf);
if (r == null && !linkedHashMap.containsKey(keyOf)) {
r = initialValueSelector.invoke(keyOf, next);
}
linkedHashMap.put(keyOf, operation.invoke(keyOf, r, next));
}
return linkedHashMap;
}
/* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object] */
public static final <T, K, R, M extends Map<? super K, R>> M foldTo(Grouping<T, ? extends K> grouping, M destination, Function2<? super K, ? super T, ? extends R> initialValueSelector, Function3<? super K, ? super R, ? super T, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(destination, "destination");
Intrinsics.checkNotNullParameter(initialValueSelector, "initialValueSelector");
Intrinsics.checkNotNullParameter(operation, "operation");
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
Object keyOf = grouping.keyOf(next);
R r = (Object) destination.get(keyOf);
if (r == null && !destination.containsKey(keyOf)) {
r = initialValueSelector.invoke(keyOf, next);
}
destination.put(keyOf, operation.invoke(keyOf, r, next));
}
return destination;
}
/* JADX WARN: Type inference failed for: r2v1, types: [java.lang.Object] */
public static final <T, K, R> Map<K, R> fold(Grouping<T, ? extends K> grouping, R r, Function2<? super R, ? super T, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(operation, "operation");
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
K keyOf = grouping.keyOf(next);
DeviceControl$Companion$$ExternalSyntheticLambda4 deviceControl$Companion$$ExternalSyntheticLambda4 = (Object) linkedHashMap.get(keyOf);
if (deviceControl$Companion$$ExternalSyntheticLambda4 == null && !linkedHashMap.containsKey(keyOf)) {
deviceControl$Companion$$ExternalSyntheticLambda4 = (Object) r;
}
linkedHashMap.put(keyOf, operation.invoke(deviceControl$Companion$$ExternalSyntheticLambda4, next));
}
return linkedHashMap;
}
/* JADX WARN: Type inference failed for: r1v1, types: [java.lang.Object] */
public static final <T, K, R, M extends Map<? super K, R>> M foldTo(Grouping<T, ? extends K> grouping, M destination, R r, Function2<? super R, ? super T, ? extends R> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(destination, "destination");
Intrinsics.checkNotNullParameter(operation, "operation");
Iterator<T> sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
?? next = sourceIterator.next();
K keyOf = grouping.keyOf(next);
DeviceControl$Companion$$ExternalSyntheticLambda4 deviceControl$Companion$$ExternalSyntheticLambda4 = (Object) destination.get(keyOf);
if (deviceControl$Companion$$ExternalSyntheticLambda4 == null && !destination.containsKey(keyOf)) {
deviceControl$Companion$$ExternalSyntheticLambda4 = (Object) r;
}
destination.put(keyOf, operation.invoke(deviceControl$Companion$$ExternalSyntheticLambda4, next));
}
return destination;
}
/* JADX WARN: Multi-variable type inference failed */
public static final <S, T extends S, K> Map<K, S> reduce(Grouping<T, ? extends K> grouping, Function3<? super K, ? super S, ? super T, ? extends S> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(operation, "operation");
LinkedHashMap linkedHashMap = new LinkedHashMap();
Iterator sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
S s = (Object) sourceIterator.next();
Object keyOf = grouping.keyOf(s);
DeviceControl$Companion$$ExternalSyntheticLambda3 deviceControl$Companion$$ExternalSyntheticLambda3 = (Object) linkedHashMap.get(keyOf);
if (!(deviceControl$Companion$$ExternalSyntheticLambda3 == null && !linkedHashMap.containsKey(keyOf))) {
s = operation.invoke(keyOf, deviceControl$Companion$$ExternalSyntheticLambda3, s);
}
linkedHashMap.put(keyOf, s);
}
return linkedHashMap;
}
/* JADX WARN: Multi-variable type inference failed */
public static final <S, T extends S, K, M extends Map<? super K, S>> M reduceTo(Grouping<T, ? extends K> grouping, M destination, Function3<? super K, ? super S, ? super T, ? extends S> operation) {
Intrinsics.checkNotNullParameter(grouping, "<this>");
Intrinsics.checkNotNullParameter(destination, "destination");
Intrinsics.checkNotNullParameter(operation, "operation");
Iterator sourceIterator = grouping.sourceIterator();
while (sourceIterator.hasNext()) {
S s = (Object) sourceIterator.next();
Object keyOf = grouping.keyOf(s);
DeviceControl$Companion$$ExternalSyntheticLambda3 deviceControl$Companion$$ExternalSyntheticLambda3 = (Object) destination.get(keyOf);
if (!(deviceControl$Companion$$ExternalSyntheticLambda3 == null && !destination.containsKey(keyOf))) {
s = operation.invoke(keyOf, deviceControl$Companion$$ExternalSyntheticLambda3, s);
}
destination.put(keyOf, s);
}
return destination;
}
}