Rabbit-R1/original r1/java/sources/kotlin/collections/CollectionsKt__IterablesKt.java
2024-05-21 17:08:36 -04:00

59 lines
4 KiB
Java

package kotlin.collections;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.exifinterface.media.ExifInterface;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import kotlin.Metadata;
import kotlin.Pair;
import kotlin.TuplesKt;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.Intrinsics;
/* JADX INFO: Access modifiers changed from: package-private */
/* compiled from: Iterables.kt */
@Metadata(d1 = {"\u0000*\n\u0000\n\u0002\u0010\u001c\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\u0010(\n\u0000\n\u0002\u0010\b\n\u0002\b\u0004\n\u0002\u0010 \n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\u001a.\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\u0014\b\u0004\u0010\u0003\u001a\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u00050\u0004H\u0087\\u0001\u0000\u001a \u0010\u0006\u001a\u00020\u0007\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u00012\u0006\u0010\b\u001a\u00020\u0007H\u0001\u001a\u001f\u0010\t\u001a\u0004\u0018\u00010\u0007\"\u0004\b\u0000\u0010\u0002*\b\u0012\u0004\u0012\u0002H\u00020\u0001H\u0001¢\u0006\u0002\u0010\n\u001a\"\u0010\u000b\u001a\b\u0012\u0004\u0012\u0002H\u00020\f\"\u0004\b\u0000\u0010\u0002*\u000e\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u00010\u0001\u001a@\u0010\r\u001a\u001a\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\f\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u000f0\f0\u000e\"\u0004\b\u0000\u0010\u0002\"\u0004\b\u0001\u0010\u000f*\u0014\u0012\u0010\u0012\u000e\u0012\u0004\u0012\u0002H\u0002\u0012\u0004\u0012\u0002H\u000f0\u000e0\u0001\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006\u0010"}, d2 = {"Iterable", "", ExifInterface.GPS_DIRECTION_TRUE, "iterator", "Lkotlin/Function0;", "", "collectionSizeOrDefault", "", "default", "collectionSizeOrNull", "(Ljava/lang/Iterable;)Ljava/lang/Integer;", "flatten", "", "unzip", "Lkotlin/Pair;", "R", "kotlin-stdlib"}, k = 5, mv = {1, 9, 0}, xi = ConstraintLayout.LayoutParams.Table.LAYOUT_EDITOR_ABSOLUTEX, xs = "kotlin/collections/CollectionsKt")
/* loaded from: classes3.dex */
public class CollectionsKt__IterablesKt extends CollectionsKt__CollectionsKt {
private static final <T> Iterable<T> Iterable(Function0<? extends Iterator<? extends T>> iterator) {
Intrinsics.checkNotNullParameter(iterator, "iterator");
return new CollectionsKt__IterablesKt$Iterable$1(iterator);
}
public static final <T> Integer collectionSizeOrNull(Iterable<? extends T> iterable) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
if (iterable instanceof Collection) {
return Integer.valueOf(((Collection) iterable).size());
}
return null;
}
public static final <T> int collectionSizeOrDefault(Iterable<? extends T> iterable, int i) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
return iterable instanceof Collection ? ((Collection) iterable).size() : i;
}
public static final <T> List<T> flatten(Iterable<? extends Iterable<? extends T>> iterable) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
ArrayList arrayList = new ArrayList();
Iterator<? extends Iterable<? extends T>> it = iterable.iterator();
while (it.hasNext()) {
CollectionsKt.addAll(arrayList, it.next());
}
return arrayList;
}
public static final <T, R> Pair<List<T>, List<R>> unzip(Iterable<? extends Pair<? extends T, ? extends R>> iterable) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
int collectionSizeOrDefault = CollectionsKt.collectionSizeOrDefault(iterable, 10);
ArrayList arrayList = new ArrayList(collectionSizeOrDefault);
ArrayList arrayList2 = new ArrayList(collectionSizeOrDefault);
for (Pair<? extends T, ? extends R> pair : iterable) {
arrayList.add(pair.getFirst());
arrayList2.add(pair.getSecond());
}
return TuplesKt.to(arrayList, arrayList2);
}
}