Files
rr3-apk/decompiled/sources/kotlin/collections/CollectionsKt__MutableCollectionsKt.java
Daniel Elliott f9d20bb3fc Add decompiled APK source code (JADX)
- 28,932 files
- Full Java source code
- Smali files
- Resources

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-02-18 14:52:23 -08:00

84 lines
3.0 KiB
Java

package kotlin.collections;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.NoSuchElementException;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.internal.Intrinsics;
/* loaded from: classes5.dex */
public abstract class CollectionsKt__MutableCollectionsKt extends CollectionsKt__MutableCollectionsJVMKt {
public static boolean addAll(Collection collection, Iterable elements) {
Intrinsics.checkNotNullParameter(collection, "<this>");
Intrinsics.checkNotNullParameter(elements, "elements");
if (elements instanceof Collection) {
return collection.addAll((Collection) elements);
}
Iterator it = elements.iterator();
boolean z = false;
while (it.hasNext()) {
if (collection.add(it.next())) {
z = true;
}
}
return z;
}
public static boolean addAll(Collection collection, Object[] elements) {
List asList;
Intrinsics.checkNotNullParameter(collection, "<this>");
Intrinsics.checkNotNullParameter(elements, "elements");
asList = ArraysKt___ArraysJvmKt.asList(elements);
return collection.addAll(asList);
}
public static final Collection convertToListIfNotCollection(Iterable iterable) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
if (!(iterable instanceof Collection)) {
iterable = CollectionsKt___CollectionsKt.toList(iterable);
}
return (Collection) iterable;
}
public static final boolean retainAll(Collection collection, Iterable elements) {
Intrinsics.checkNotNullParameter(collection, "<this>");
Intrinsics.checkNotNullParameter(elements, "elements");
return collection.retainAll(convertToListIfNotCollection(elements));
}
public static boolean removeAll(Iterable iterable, Function1 predicate) {
Intrinsics.checkNotNullParameter(iterable, "<this>");
Intrinsics.checkNotNullParameter(predicate, "predicate");
return filterInPlace$CollectionsKt__MutableCollectionsKt(iterable, predicate, true);
}
public static final boolean filterInPlace$CollectionsKt__MutableCollectionsKt(Iterable iterable, Function1 function1, boolean z) {
Iterator it = iterable.iterator();
boolean z2 = false;
while (it.hasNext()) {
if (((Boolean) function1.invoke(it.next())).booleanValue() == z) {
it.remove();
z2 = true;
}
}
return z2;
}
public static Object removeFirstOrNull(List list) {
Intrinsics.checkNotNullParameter(list, "<this>");
if (list.isEmpty()) {
return null;
}
return list.remove(0);
}
public static Object removeLast(List list) {
Intrinsics.checkNotNullParameter(list, "<this>");
if (list.isEmpty()) {
throw new NoSuchElementException("List is empty.");
}
return list.remove(CollectionsKt__CollectionsKt.getLastIndex(list));
}
}