discord-jadx/app/src/main/java/androidx/core/util/SparseIntArrayKt.java

123 lines
4.6 KiB
Java

package androidx.core.util;
import android.util.SparseIntArray;
import d0.t.c0;
import d0.z.d.m;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.functions.Function2;
/* compiled from: SparseIntArray.kt */
public final class SparseIntArrayKt {
public static final boolean contains(SparseIntArray sparseIntArray, int i) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.indexOfKey(i) >= 0;
}
public static final boolean containsKey(SparseIntArray sparseIntArray, int i) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.indexOfKey(i) >= 0;
}
public static final boolean containsValue(SparseIntArray sparseIntArray, int i) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.indexOfValue(i) >= 0;
}
public static final void forEach(SparseIntArray sparseIntArray, Function2<? super Integer, ? super Integer, Unit> function2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
m.checkNotNullParameter(function2, "action");
int size = sparseIntArray.size();
if (size > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
function2.invoke(Integer.valueOf(sparseIntArray.keyAt(i)), Integer.valueOf(sparseIntArray.valueAt(i)));
if (i2 < size) {
i = i2;
} else {
return;
}
}
}
}
public static final int getOrDefault(SparseIntArray sparseIntArray, int i, int i2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.get(i, i2);
}
public static final int getOrElse(SparseIntArray sparseIntArray, int i, Function0<Integer> function0) {
m.checkNotNullParameter(sparseIntArray, "<this>");
m.checkNotNullParameter(function0, "defaultValue");
int indexOfKey = sparseIntArray.indexOfKey(i);
return indexOfKey >= 0 ? sparseIntArray.valueAt(indexOfKey) : function0.mo1invoke().intValue();
}
public static final int getSize(SparseIntArray sparseIntArray) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.size();
}
public static final boolean isEmpty(SparseIntArray sparseIntArray) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.size() == 0;
}
public static final boolean isNotEmpty(SparseIntArray sparseIntArray) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return sparseIntArray.size() != 0;
}
public static final c0 keyIterator(SparseIntArray sparseIntArray) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return new SparseIntArrayKt$keyIterator$1(sparseIntArray);
}
public static final SparseIntArray plus(SparseIntArray sparseIntArray, SparseIntArray sparseIntArray2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
m.checkNotNullParameter(sparseIntArray2, "other");
SparseIntArray sparseIntArray3 = new SparseIntArray(sparseIntArray2.size() + sparseIntArray.size());
putAll(sparseIntArray3, sparseIntArray);
putAll(sparseIntArray3, sparseIntArray2);
return sparseIntArray3;
}
public static final void putAll(SparseIntArray sparseIntArray, SparseIntArray sparseIntArray2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
m.checkNotNullParameter(sparseIntArray2, "other");
int size = sparseIntArray2.size();
if (size > 0) {
int i = 0;
while (true) {
int i2 = i + 1;
sparseIntArray.put(sparseIntArray2.keyAt(i), sparseIntArray2.valueAt(i));
if (i2 < size) {
i = i2;
} else {
return;
}
}
}
}
public static final boolean remove(SparseIntArray sparseIntArray, int i, int i2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
int indexOfKey = sparseIntArray.indexOfKey(i);
if (indexOfKey < 0 || i2 != sparseIntArray.valueAt(indexOfKey)) {
return false;
}
sparseIntArray.removeAt(indexOfKey);
return true;
}
public static final void set(SparseIntArray sparseIntArray, int i, int i2) {
m.checkNotNullParameter(sparseIntArray, "<this>");
sparseIntArray.put(i, i2);
}
public static final c0 valueIterator(SparseIntArray sparseIntArray) {
m.checkNotNullParameter(sparseIntArray, "<this>");
return new SparseIntArrayKt$valueIterator$1(sparseIntArray);
}
}