122 lines
4.8 KiB
Java
122 lines
4.8 KiB
Java
package androidx.core.util;
|
|
|
|
import android.util.SparseLongArray;
|
|
import androidx.annotation.RequiresApi;
|
|
import d0.t.c0;
|
|
import d0.t.d0;
|
|
import d0.z.d.m;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function2;
|
|
/* compiled from: SparseLongArray.kt */
|
|
public final class SparseLongArrayKt {
|
|
@RequiresApi(18)
|
|
public static final boolean contains(SparseLongArray sparseLongArray, int i) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$contains");
|
|
return sparseLongArray.indexOfKey(i) >= 0;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final boolean containsKey(SparseLongArray sparseLongArray, int i) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$containsKey");
|
|
return sparseLongArray.indexOfKey(i) >= 0;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final boolean containsValue(SparseLongArray sparseLongArray, long j) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$containsValue");
|
|
return sparseLongArray.indexOfValue(j) >= 0;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final void forEach(SparseLongArray sparseLongArray, Function2<? super Integer, ? super Long, Unit> function2) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$forEach");
|
|
m.checkParameterIsNotNull(function2, "action");
|
|
int size = sparseLongArray.size();
|
|
for (int i = 0; i < size; i++) {
|
|
function2.invoke(Integer.valueOf(sparseLongArray.keyAt(i)), Long.valueOf(sparseLongArray.valueAt(i)));
|
|
}
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final long getOrDefault(SparseLongArray sparseLongArray, int i, long j) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$getOrDefault");
|
|
return sparseLongArray.get(i, j);
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final long getOrElse(SparseLongArray sparseLongArray, int i, Function0<Long> function0) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$getOrElse");
|
|
m.checkParameterIsNotNull(function0, "defaultValue");
|
|
int indexOfKey = sparseLongArray.indexOfKey(i);
|
|
return indexOfKey >= 0 ? sparseLongArray.valueAt(indexOfKey) : function0.mo1invoke().longValue();
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final int getSize(SparseLongArray sparseLongArray) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$size");
|
|
return sparseLongArray.size();
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final boolean isEmpty(SparseLongArray sparseLongArray) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$isEmpty");
|
|
return sparseLongArray.size() == 0;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final boolean isNotEmpty(SparseLongArray sparseLongArray) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$isNotEmpty");
|
|
return sparseLongArray.size() != 0;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final c0 keyIterator(SparseLongArray sparseLongArray) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$keyIterator");
|
|
return new SparseLongArrayKt$keyIterator$1(sparseLongArray);
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final SparseLongArray plus(SparseLongArray sparseLongArray, SparseLongArray sparseLongArray2) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$plus");
|
|
m.checkParameterIsNotNull(sparseLongArray2, "other");
|
|
SparseLongArray sparseLongArray3 = new SparseLongArray(sparseLongArray2.size() + sparseLongArray.size());
|
|
putAll(sparseLongArray3, sparseLongArray);
|
|
putAll(sparseLongArray3, sparseLongArray2);
|
|
return sparseLongArray3;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final void putAll(SparseLongArray sparseLongArray, SparseLongArray sparseLongArray2) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$putAll");
|
|
m.checkParameterIsNotNull(sparseLongArray2, "other");
|
|
int size = sparseLongArray2.size();
|
|
for (int i = 0; i < size; i++) {
|
|
sparseLongArray.put(sparseLongArray2.keyAt(i), sparseLongArray2.valueAt(i));
|
|
}
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final boolean remove(SparseLongArray sparseLongArray, int i, long j) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$remove");
|
|
int indexOfKey = sparseLongArray.indexOfKey(i);
|
|
if (indexOfKey < 0 || j != sparseLongArray.valueAt(indexOfKey)) {
|
|
return false;
|
|
}
|
|
sparseLongArray.removeAt(indexOfKey);
|
|
return true;
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final void set(SparseLongArray sparseLongArray, int i, long j) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$set");
|
|
sparseLongArray.put(i, j);
|
|
}
|
|
|
|
@RequiresApi(18)
|
|
public static final d0 valueIterator(SparseLongArray sparseLongArray) {
|
|
m.checkParameterIsNotNull(sparseLongArray, "$this$valueIterator");
|
|
return new SparseLongArrayKt$valueIterator$1(sparseLongArray);
|
|
}
|
|
}
|