Files
rr3-apk/decompiled/sources/androidx/collection/SparseArrayCompat.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

371 lines
13 KiB
Java

package androidx.collection;
import androidx.collection.internal.ContainerHelpersKt;
import com.applovin.impl.sdk.utils.JsonUtils;
import com.ironsource.nb;
import java.util.Arrays;
import kotlin.collections.ArraysKt___ArraysJvmKt;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.jvm.internal.Intrinsics;
import kotlin.jvm.internal.SourceDebugExtension;
@SourceDebugExtension({"SMAP\nSparseArrayCompat.jvm.kt\nKotlin\n*S Kotlin\n*F\n+ 1 SparseArrayCompat.jvm.kt\nandroidx/collection/SparseArrayCompat\n+ 2 SparseArrayCompat.kt\nandroidx/collection/SparseArrayCompatKt\n*L\n1#1,273:1\n275#2,9:274\n288#2,5:283\n296#2,5:288\n304#2,8:293\n320#2,9:301\n353#2,40:310\n396#2,2:350\n353#2,47:352\n403#2,3:399\n353#2,40:402\n407#2:442\n412#2,4:443\n419#2:447\n423#2,4:448\n431#2,8:452\n443#2,5:460\n451#2,4:465\n459#2,9:469\n472#2:478\n477#2:479\n459#2,9:480\n482#2,8:489\n493#2,17:497\n513#2,21:514\n*S KotlinDebug\n*F\n+ 1 SparseArrayCompat.jvm.kt\nandroidx/collection/SparseArrayCompat\n*L\n130#1:274,9\n135#1:283,5\n144#1:288,5\n152#1:293,8\n163#1:301,9\n169#1:310,40\n176#1:350,2\n176#1:352,47\n186#1:399,3\n186#1:402,40\n186#1:442\n191#1:443,4\n205#1:447\n212#1:448,4\n218#1:452,8\n224#1:460,5\n234#1:465,4\n246#1:469,9\n249#1:478\n252#1:479\n252#1:480,9\n257#1:489,8\n263#1:497,17\n271#1:514,21\n*E\n"})
/* loaded from: classes.dex */
public class SparseArrayCompat<E> implements Cloneable {
public /* synthetic */ boolean garbage;
public /* synthetic */ int[] keys;
public /* synthetic */ int size;
public /* synthetic */ Object[] values;
public SparseArrayCompat() {
this(0, 1, null);
}
public SparseArrayCompat(int i) {
if (i == 0) {
this.keys = ContainerHelpersKt.EMPTY_INTS;
this.values = ContainerHelpersKt.EMPTY_OBJECTS;
} else {
int idealIntArraySize = ContainerHelpersKt.idealIntArraySize(i);
this.keys = new int[idealIntArraySize];
this.values = new Object[idealIntArraySize];
}
}
public /* synthetic */ SparseArrayCompat(int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
this((i2 & 1) != 0 ? 10 : i);
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public SparseArrayCompat<E> m35clone() {
Object clone = super.clone();
Intrinsics.checkNotNull(clone, "null cannot be cast to non-null type androidx.collection.SparseArrayCompat<E of androidx.collection.SparseArrayCompat>");
SparseArrayCompat<E> sparseArrayCompat = (SparseArrayCompat) clone;
sparseArrayCompat.keys = (int[]) this.keys.clone();
sparseArrayCompat.values = (Object[]) this.values.clone();
return sparseArrayCompat;
}
public E get(int i) {
return (E) SparseArrayCompatKt.commonGet(this, i);
}
public E get(int i, E e) {
return (E) SparseArrayCompatKt.commonGet(this, i, e);
}
public void delete(int i) {
remove(i);
}
public void remove(int i) {
SparseArrayCompatKt.commonRemove(this, i);
}
public final boolean getIsEmpty() {
return isEmpty();
}
public boolean remove(int i, Object obj) {
int indexOfKey = indexOfKey(i);
if (indexOfKey < 0 || !Intrinsics.areEqual(obj, valueAt(indexOfKey))) {
return false;
}
removeAt(indexOfKey);
return true;
}
public void removeAt(int i) {
if (this.values[i] != SparseArrayCompatKt.DELETED) {
this.values[i] = SparseArrayCompatKt.DELETED;
this.garbage = true;
}
}
public void removeAtRange(int i, int i2) {
int min = Math.min(i2, i + i2);
while (i < min) {
removeAt(i);
i++;
}
}
public E replace(int i, E e) {
int indexOfKey = indexOfKey(i);
if (indexOfKey < 0) {
return null;
}
Object[] objArr = this.values;
E e2 = (E) objArr[indexOfKey];
objArr[indexOfKey] = e;
return e2;
}
public boolean replace(int i, E e, E e2) {
int indexOfKey = indexOfKey(i);
if (indexOfKey < 0 || !Intrinsics.areEqual(this.values[indexOfKey], e)) {
return false;
}
this.values[indexOfKey] = e2;
return true;
}
public void put(int i, E e) {
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, i);
if (binarySearch >= 0) {
this.values[binarySearch] = e;
return;
}
int i2 = ~binarySearch;
if (i2 < this.size && this.values[i2] == SparseArrayCompatKt.DELETED) {
this.keys[i2] = i;
this.values[i2] = e;
return;
}
if (this.garbage && this.size >= this.keys.length) {
SparseArrayCompatKt.gc(this);
i2 = ~ContainerHelpersKt.binarySearch(this.keys, this.size, i);
}
int i3 = this.size;
if (i3 >= this.keys.length) {
int idealIntArraySize = ContainerHelpersKt.idealIntArraySize(i3 + 1);
int[] copyOf = Arrays.copyOf(this.keys, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.keys = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.values, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.values = copyOf2;
}
int i4 = this.size;
if (i4 - i2 != 0) {
int[] iArr = this.keys;
int i5 = i2 + 1;
ArraysKt___ArraysJvmKt.copyInto(iArr, iArr, i5, i2, i4);
Object[] objArr = this.values;
ArraysKt___ArraysJvmKt.copyInto(objArr, objArr, i5, i2, this.size);
}
this.keys[i2] = i;
this.values[i2] = e;
this.size++;
}
public void putAll(SparseArrayCompat<? extends E> other) {
Intrinsics.checkNotNullParameter(other, "other");
int size = other.size();
for (int i = 0; i < size; i++) {
int keyAt = other.keyAt(i);
E valueAt = other.valueAt(i);
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, keyAt);
if (binarySearch >= 0) {
this.values[binarySearch] = valueAt;
} else {
int i2 = ~binarySearch;
if (i2 < this.size && this.values[i2] == SparseArrayCompatKt.DELETED) {
this.keys[i2] = keyAt;
this.values[i2] = valueAt;
} else {
if (this.garbage && this.size >= this.keys.length) {
SparseArrayCompatKt.gc(this);
i2 = ~ContainerHelpersKt.binarySearch(this.keys, this.size, keyAt);
}
int i3 = this.size;
if (i3 >= this.keys.length) {
int idealIntArraySize = ContainerHelpersKt.idealIntArraySize(i3 + 1);
int[] copyOf = Arrays.copyOf(this.keys, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.keys = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.values, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.values = copyOf2;
}
int i4 = this.size;
if (i4 - i2 != 0) {
int[] iArr = this.keys;
int i5 = i2 + 1;
ArraysKt___ArraysJvmKt.copyInto(iArr, iArr, i5, i2, i4);
Object[] objArr = this.values;
ArraysKt___ArraysJvmKt.copyInto(objArr, objArr, i5, i2, this.size);
}
this.keys[i2] = keyAt;
this.values[i2] = valueAt;
this.size++;
}
}
}
}
public E putIfAbsent(int i, E e) {
E e2 = (E) SparseArrayCompatKt.commonGet(this, i);
if (e2 == null) {
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, i);
if (binarySearch >= 0) {
this.values[binarySearch] = e;
} else {
int i2 = ~binarySearch;
if (i2 < this.size && this.values[i2] == SparseArrayCompatKt.DELETED) {
this.keys[i2] = i;
this.values[i2] = e;
} else {
if (this.garbage && this.size >= this.keys.length) {
SparseArrayCompatKt.gc(this);
i2 = ~ContainerHelpersKt.binarySearch(this.keys, this.size, i);
}
int i3 = this.size;
if (i3 >= this.keys.length) {
int idealIntArraySize = ContainerHelpersKt.idealIntArraySize(i3 + 1);
int[] copyOf = Arrays.copyOf(this.keys, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.keys = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.values, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.values = copyOf2;
}
int i4 = this.size;
if (i4 - i2 != 0) {
int[] iArr = this.keys;
int i5 = i2 + 1;
ArraysKt___ArraysJvmKt.copyInto(iArr, iArr, i5, i2, i4);
Object[] objArr = this.values;
ArraysKt___ArraysJvmKt.copyInto(objArr, objArr, i5, i2, this.size);
}
this.keys[i2] = i;
this.values[i2] = e;
this.size++;
}
}
}
return e2;
}
public int size() {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
return this.size;
}
public boolean isEmpty() {
return size() == 0;
}
public int keyAt(int i) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
return this.keys[i];
}
public E valueAt(int i) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
return (E) this.values[i];
}
public void setValueAt(int i, E e) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
this.values[i] = e;
}
public int indexOfKey(int i) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
return ContainerHelpersKt.binarySearch(this.keys, this.size, i);
}
public boolean containsValue(E e) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
int i = this.size;
int i2 = 0;
while (i2 < i) {
if (this.values[i2] == e) {
return i2 >= 0;
}
i2++;
}
return false;
}
public int indexOfValue(E e) {
if (this.garbage) {
SparseArrayCompatKt.gc(this);
}
int i = this.size;
for (int i2 = 0; i2 < i; i2++) {
if (this.values[i2] == e) {
return i2;
}
}
return -1;
}
public boolean containsKey(int i) {
return indexOfKey(i) >= 0;
}
public void clear() {
int i = this.size;
Object[] objArr = this.values;
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = null;
}
this.size = 0;
this.garbage = false;
}
public void append(int i, E e) {
int i2 = this.size;
if (i2 != 0 && i <= this.keys[i2 - 1]) {
put(i, e);
return;
}
if (this.garbage && i2 >= this.keys.length) {
SparseArrayCompatKt.gc(this);
}
int i3 = this.size;
if (i3 >= this.keys.length) {
int idealIntArraySize = ContainerHelpersKt.idealIntArraySize(i3 + 1);
int[] copyOf = Arrays.copyOf(this.keys, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf, "copyOf(this, newSize)");
this.keys = copyOf;
Object[] copyOf2 = Arrays.copyOf(this.values, idealIntArraySize);
Intrinsics.checkNotNullExpressionValue(copyOf2, "copyOf(this, newSize)");
this.values = copyOf2;
}
this.keys[i3] = i;
this.values[i3] = e;
this.size = i3 + 1;
}
public String toString() {
if (size() <= 0) {
return JsonUtils.EMPTY_JSON;
}
StringBuilder sb = new StringBuilder(this.size * 28);
sb.append('{');
int i = this.size;
for (int i2 = 0; i2 < i; i2++) {
if (i2 > 0) {
sb.append(", ");
}
sb.append(keyAt(i2));
sb.append(nb.T);
E valueAt = valueAt(i2);
if (valueAt != this) {
sb.append(valueAt);
} else {
sb.append("(this Map)");
}
}
sb.append('}');
String sb2 = sb.toString();
Intrinsics.checkNotNullExpressionValue(sb2, "buffer.toString()");
return sb2;
}
}