ADD week 5
This commit is contained in:
		| @@ -0,0 +1,120 @@ | ||||
| package kotlin.collections; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Collection; | ||||
| import java.util.Collections; | ||||
| import java.util.Enumeration; | ||||
| import java.util.List; | ||||
| import java.util.Random; | ||||
| import kotlin.Metadata; | ||||
| import kotlin.Unit; | ||||
| import kotlin.collections.builders.ListBuilder; | ||||
| import kotlin.internal.PlatformImplementationsKt; | ||||
| import kotlin.jvm.functions.Function1; | ||||
| import kotlin.jvm.internal.CollectionToArray; | ||||
| import kotlin.jvm.internal.Intrinsics; | ||||
|  | ||||
| /* JADX INFO: Access modifiers changed from: package-private */ | ||||
| /* compiled from: CollectionsJVM.kt */ | ||||
| @Metadata(d1 = {"\u0000T\n\u0000\n\u0002\u0010 \n\u0002\b\u0002\n\u0002\u0010!\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\u0010\u0002\n\u0002\u0018\u0002\n\u0002\b\u0005\n\u0002\u0010\u0011\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u001e\n\u0002\b\n\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\u001c\n\u0000\n\u0002\u0018\u0002\n\u0000\n\u0002\u0018\u0002\n\u0000\u001a\"\u0010\u0000\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\f\u0010\u0003\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0004H\u0001\u001a?\u0010\u0005\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\u0006\u0010\u0006\u001a\u00020\u00072\u001d\u0010\b\u001a\u0019\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u0004\u0012\u0004\u0012\u00020\n0\t¢\u0006\u0002\b\u000bH\u0081\bø\u0001\u0000\u001a7\u0010\u0005\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0001\"\u0004\b\u0000\u0010\u00022\u001d\u0010\b\u001a\u0019\u0012\n\u0012\b\u0012\u0004\u0012\u0002H\u00020\u0004\u0012\u0004\u0012\u00020\n0\t¢\u0006\u0002\b\u000bH\u0081\bø\u0001\u0000\u001a\u0011\u0010\f\u001a\u00020\u00072\u0006\u0010\r\u001a\u00020\u0007H\u0081\b\u001a\u0011\u0010\u000e\u001a\u00020\u00072\u0006\u0010\u000f\u001a\u00020\u0007H\u0081\b\u001a\"\u0010\u0010\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\u00120\u00112\n\u0010\u0013\u001a\u0006\u0012\u0002\b\u00030\u0014H\u0081\b¢\u0006\u0002\u0010\u0015\u001a4\u0010\u0010\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0011\"\u0004\b\u0000\u0010\u00162\n\u0010\u0013\u001a\u0006\u0012\u0002\b\u00030\u00142\f\u0010\u0017\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0011H\u0081\b¢\u0006\u0002\u0010\u0018\u001a\u0014\u0010\u0019\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0004\"\u0004\b\u0000\u0010\u0002H\u0001\u001a\u001c\u0010\u0019\u001a\b\u0012\u0004\u0012\u0002H\u00020\u0004\"\u0004\b\u0000\u0010\u00022\u0006\u0010\u0006\u001a\u00020\u0007H\u0001\u001a\u001f\u0010\u001a\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0001\"\u0004\b\u0000\u0010\u00162\u0006\u0010\u001b\u001a\u0002H\u0016¢\u0006\u0002\u0010\u001c\u001a1\u0010\u001d\u001a\f\u0012\b\b\u0001\u0012\u0004\u0018\u00010\u00120\u0011\"\u0004\b\u0000\u0010\u0016*\n\u0012\u0006\b\u0001\u0012\u0002H\u00160\u00112\u0006\u0010\u001e\u001a\u00020\u001fH\u0000¢\u0006\u0002\u0010 \u001a\u001e\u0010!\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0001\"\u0004\b\u0000\u0010\u0016*\b\u0012\u0004\u0012\u0002H\u00160\"H\u0007\u001a&\u0010!\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0001\"\u0004\b\u0000\u0010\u0016*\b\u0012\u0004\u0012\u0002H\u00160\"2\u0006\u0010#\u001a\u00020$H\u0007\u001a\u001f\u0010%\u001a\b\u0012\u0004\u0012\u0002H\u00160\u0001\"\u0004\b\u0000\u0010\u0016*\b\u0012\u0004\u0012\u0002H\u00160&H\u0087\b\u0082\u0002\u0007\n\u0005\b\u009920\u0001¨\u0006'"}, d2 = {"build", "", "E", "builder", "", "buildListInternal", "capacity", "", "builderAction", "Lkotlin/Function1;", "", "Lkotlin/ExtensionFunctionType;", "checkCountOverflow", "count", "checkIndexOverflow", "index", "copyToArrayImpl", "", "", "collection", "", "(Ljava/util/Collection;)[Ljava/lang/Object;", "T", "array", "(Ljava/util/Collection;[Ljava/lang/Object;)[Ljava/lang/Object;", "createListBuilder", "listOf", "element", "(Ljava/lang/Object;)Ljava/util/List;", "copyToArrayOfAny", "isVarargs", "", "([Ljava/lang/Object;Z)[Ljava/lang/Object;", "shuffled", "", "random", "Ljava/util/Random;", "toList", "Ljava/util/Enumeration;", "kotlin-stdlib"}, k = 5, mv = {1, 8, 0}, xi = 49, xs = "kotlin/collections/CollectionsKt") | ||||
| /* loaded from: classes.dex */ | ||||
| public class CollectionsKt__CollectionsJVMKt { | ||||
|     public static final <T> List<T> listOf(T t) { | ||||
|         List<T> singletonList = Collections.singletonList(t); | ||||
|         Intrinsics.checkNotNullExpressionValue(singletonList, "singletonList(element)"); | ||||
|         return singletonList; | ||||
|     } | ||||
|  | ||||
|     private static final <E> List<E> buildListInternal(Function1<? super List<E>, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         List createListBuilder = CollectionsKt.createListBuilder(); | ||||
|         builderAction.invoke(createListBuilder); | ||||
|         return CollectionsKt.build(createListBuilder); | ||||
|     } | ||||
|  | ||||
|     private static final <E> List<E> buildListInternal(int i, Function1<? super List<E>, Unit> builderAction) { | ||||
|         Intrinsics.checkNotNullParameter(builderAction, "builderAction"); | ||||
|         List createListBuilder = CollectionsKt.createListBuilder(i); | ||||
|         builderAction.invoke(createListBuilder); | ||||
|         return CollectionsKt.build(createListBuilder); | ||||
|     } | ||||
|  | ||||
|     public static final <E> List<E> createListBuilder() { | ||||
|         return new ListBuilder(); | ||||
|     } | ||||
|  | ||||
|     public static final <E> List<E> createListBuilder(int i) { | ||||
|         return new ListBuilder(i); | ||||
|     } | ||||
|  | ||||
|     public static final <E> List<E> build(List<E> builder) { | ||||
|         Intrinsics.checkNotNullParameter(builder, "builder"); | ||||
|         return ((ListBuilder) builder).build(); | ||||
|     } | ||||
|  | ||||
|     private static final <T> List<T> toList(Enumeration<T> enumeration) { | ||||
|         Intrinsics.checkNotNullParameter(enumeration, "<this>"); | ||||
|         ArrayList list = Collections.list(enumeration); | ||||
|         Intrinsics.checkNotNullExpressionValue(list, "list(this)"); | ||||
|         return list; | ||||
|     } | ||||
|  | ||||
|     public static final <T> List<T> shuffled(Iterable<? extends T> iterable) { | ||||
|         Intrinsics.checkNotNullParameter(iterable, "<this>"); | ||||
|         List<T> mutableList = CollectionsKt.toMutableList(iterable); | ||||
|         Collections.shuffle(mutableList); | ||||
|         return mutableList; | ||||
|     } | ||||
|  | ||||
|     public static final <T> List<T> shuffled(Iterable<? extends T> iterable, Random random) { | ||||
|         Intrinsics.checkNotNullParameter(iterable, "<this>"); | ||||
|         Intrinsics.checkNotNullParameter(random, "random"); | ||||
|         List<T> mutableList = CollectionsKt.toMutableList(iterable); | ||||
|         Collections.shuffle(mutableList, random); | ||||
|         return mutableList; | ||||
|     } | ||||
|  | ||||
|     private static final Object[] copyToArrayImpl(Collection<?> collection) { | ||||
|         Intrinsics.checkNotNullParameter(collection, "collection"); | ||||
|         return CollectionToArray.toArray(collection); | ||||
|     } | ||||
|  | ||||
|     private static final <T> T[] copyToArrayImpl(Collection<?> collection, T[] array) { | ||||
|         Intrinsics.checkNotNullParameter(collection, "collection"); | ||||
|         Intrinsics.checkNotNullParameter(array, "array"); | ||||
|         return (T[]) CollectionToArray.toArray(collection, array); | ||||
|     } | ||||
|  | ||||
|     public static final <T> Object[] copyToArrayOfAny(T[] tArr, boolean z) { | ||||
|         Intrinsics.checkNotNullParameter(tArr, "<this>"); | ||||
|         if (z && Intrinsics.areEqual(tArr.getClass(), Object[].class)) { | ||||
|             return tArr; | ||||
|         } | ||||
|         Object[] copyOf = Arrays.copyOf(tArr, tArr.length, Object[].class); | ||||
|         Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, this.size, Array<Any?>::class.java)"); | ||||
|         return copyOf; | ||||
|     } | ||||
|  | ||||
|     private static final int checkIndexOverflow(int i) { | ||||
|         if (i < 0) { | ||||
|             if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) { | ||||
|                 CollectionsKt.throwIndexOverflow(); | ||||
|             } else { | ||||
|                 throw new ArithmeticException("Index overflow has happened."); | ||||
|             } | ||||
|         } | ||||
|         return i; | ||||
|     } | ||||
|  | ||||
|     private static final int checkCountOverflow(int i) { | ||||
|         if (i < 0) { | ||||
|             if (PlatformImplementationsKt.apiVersionIsAtLeast(1, 3, 0)) { | ||||
|                 CollectionsKt.throwCountOverflow(); | ||||
|             } else { | ||||
|                 throw new ArithmeticException("Count overflow has happened."); | ||||
|             } | ||||
|         } | ||||
|         return i; | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user