mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-14 09:57:16 +01:00
450 lines
20 KiB
Java
450 lines
20 KiB
Java
package androidx.collection;
|
|
|
|
import androidx.collection.internal.ContainerHelpersKt;
|
|
import androidx.collection.internal.RuntimeHelpersKt;
|
|
import androidx.exifinterface.media.ExifInterface;
|
|
import com.amazon.alexa.redesign.view.container.CardStudioAgentSpaceMetrics;
|
|
import com.amazon.clouddrive.extended.model.BulkOperationType;
|
|
import com.dee.app.metrics.MetricsConstants;
|
|
import java.util.Arrays;
|
|
import kotlin.Deprecated;
|
|
import kotlin.Metadata;
|
|
import kotlin.ReplaceWith;
|
|
import kotlin.collections.ArraysKt;
|
|
import kotlin.collections.ArraysKt___ArraysJvmKt;
|
|
import kotlin.jvm.JvmField;
|
|
import kotlin.jvm.JvmOverloads;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.jvm.internal.Intrinsics;
|
|
import kotlin.jvm.internal.SourceDebugExtension;
|
|
import kotlinx.serialization.json.internal.AbstractJsonLexerKt;
|
|
import org.jetbrains.annotations.NotNull;
|
|
import org.jetbrains.annotations.Nullable;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
@Metadata(d1 = {"\u0000D\n\u0002\u0018\u0002\n\u0000\n\u0002\u0010\u001a\n\u0000\n\u0002\u0010\b\n\u0002\b\u0002\n\u0002\u0010\u000b\n\u0000\n\u0002\u0010\u0016\n\u0002\b\u0002\n\u0002\u0010\u0011\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\t\n\u0002\b \n\u0002\u0010\u000e\n\u0002\b\u0003\b\u0016\u0018\u0000*\u0004\b\u0000\u0010\u00012\u00020\u0002B\u0011\b\u0007\u0012\b\b\u0002\u0010\u0003\u001a\u00020\u0004¢\u0006\u0002\u0010\u0005J\u001d\u0010\u000f\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0014J\b\u0010\u0015\u001a\u00020\u0010H\u0016J\u000e\u0010\u0016\u001a\b\u0012\u0004\u0012\u00028\u00000\u0000H\u0016J\u0010\u0010\u0017\u001a\u00020\u00072\u0006\u0010\u0011\u001a\u00020\u0012H\u0016J\u0015\u0010\u0018\u001a\u00020\u00072\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0019J\u0010\u0010\u001a\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0017J\u0018\u0010\u001b\u001a\u0004\u0018\u00018\u00002\u0006\u0010\u0011\u001a\u00020\u0012H\u0096\u0002¢\u0006\u0002\u0010\u001cJ\u001d\u0010\u001b\u001a\u00028\u00002\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u001d\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u001eJ\u0010\u0010\u001f\u001a\u00020\u00042\u0006\u0010\u0011\u001a\u00020\u0012H\u0016J\u0015\u0010 \u001a\u00020\u00042\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010!J\b\u0010\"\u001a\u00020\u0007H\u0016J\u0010\u0010#\u001a\u00020\u00122\u0006\u0010$\u001a\u00020\u0004H\u0016J\u001d\u0010%\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u0014J\u0018\u0010&\u001a\u00020\u00102\u000e\u0010'\u001a\n\u0012\u0006\b\u0001\u0012\u00028\u00000\u0000H\u0016J\u001f\u0010(\u001a\u0004\u0018\u00018\u00002\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u001eJ\u0010\u0010)\u001a\u00020\u00102\u0006\u0010\u0011\u001a\u00020\u0012H\u0016J\u001d\u0010)\u001a\u00020\u00072\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010*J\u0010\u0010+\u001a\u00020\u00102\u0006\u0010$\u001a\u00020\u0004H\u0016J\u001f\u0010,\u001a\u0004\u0018\u00018\u00002\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010\u001eJ%\u0010,\u001a\u00020\u00072\u0006\u0010\u0011\u001a\u00020\u00122\u0006\u0010-\u001a\u00028\u00002\u0006\u0010.\u001a\u00028\u0000H\u0016¢\u0006\u0002\u0010/J\u001d\u00100\u001a\u00020\u00102\u0006\u0010$\u001a\u00020\u00042\u0006\u0010\u0013\u001a\u00028\u0000H\u0016¢\u0006\u0002\u00101J\b\u0010\n\u001a\u00020\u0004H\u0016J\b\u00102\u001a\u000203H\u0016J\u0015\u00104\u001a\u00028\u00002\u0006\u0010$\u001a\u00020\u0004H\u0016¢\u0006\u0002\u00105R\u0012\u0010\u0006\u001a\u00020\u00078\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\b\u001a\u00020\t8\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000R\u0012\u0010\n\u001a\u00020\u00048\u0000@\u0000X\u0081\u000e¢\u0006\u0002\n\u0000R\u001c\u0010\u000b\u001a\n\u0012\u0006\u0012\u0004\u0018\u00010\r0\f8\u0000@\u0000X\u0081\u000e¢\u0006\u0004\n\u0002\u0010\u000e¨\u00066"}, d2 = {"Landroidx/collection/LongSparseArray;", ExifInterface.LONGITUDE_EAST, "", "initialCapacity", "", "(I)V", "garbage", "", "keys", "", "size", "values", "", "", "[Ljava/lang/Object;", "append", "", "key", "", "value", "(JLjava/lang/Object;)V", MetricsConstants.Method.CACHE_CLEAR, "clone", "containsKey", "containsValue", "(Ljava/lang/Object;)Z", "delete", MetricsConstants.Method.CACHE_GET, "(J)Ljava/lang/Object;", "defaultValue", "(JLjava/lang/Object;)Ljava/lang/Object;", "indexOfKey", "indexOfValue", "(Ljava/lang/Object;)I", "isEmpty", "keyAt", "index", MetricsConstants.Method.CACHE_PUT, "putAll", CardStudioAgentSpaceMetrics.DimensionValue.SCHEME_OTHER, "putIfAbsent", BulkOperationType.remove, "(JLjava/lang/Object;)Z", "removeAt", "replace", "oldValue", "newValue", "(JLjava/lang/Object;Ljava/lang/Object;)Z", "setValueAt", "(ILjava/lang/Object;)V", "toString", "", "valueAt", "(I)Ljava/lang/Object;", "collection"}, k = 1, mv = {1, 9, 0}, xi = 48)
|
|
@SourceDebugExtension({"SMAP\nLongSparseArray.jvm.kt\nKotlin\n*S Kotlin\n*F\n+ 1 LongSparseArray.jvm.kt\nandroidx/collection/LongSparseArray\n+ 2 LongSparseArray.kt\nandroidx/collection/LongSparseArrayKt\n+ 3 fake.kt\nkotlin/jvm/internal/FakeKt\n+ 4 RuntimeHelpers.kt\nandroidx/collection/internal/RuntimeHelpersKt\n*L\n1#1,243:1\n218#2:244\n229#2,5:245\n223#2,11:250\n239#2,8:261\n239#2,8:269\n250#2,9:277\n263#2,5:286\n271#2,7:291\n286#2,9:298\n320#2,12:307\n299#2,18:319\n334#2,21:337\n358#2,2:358\n360#2:361\n364#2,5:362\n373#2,2:367\n299#2,18:369\n376#2:387\n380#2:388\n384#2:389\n385#2:393\n388#2,2:395\n299#2,18:397\n391#2:415\n396#2:416\n397#2:420\n400#2,2:422\n299#2,18:424\n404#2:442\n409#2:443\n410#2:447\n413#2,2:449\n299#2,18:451\n416#2,2:469\n421#2,2:471\n299#2,18:473\n424#2:491\n429#2,2:492\n299#2,18:494\n432#2,6:512\n442#2:518\n447#2:519\n452#2,8:520\n463#2,6:528\n299#2,18:534\n470#2,10:552\n483#2,21:562\n1#3:360\n59#4,3:390\n63#4:394\n59#4,3:417\n63#4:421\n59#4,3:444\n63#4:448\n*S KotlinDebug\n*F\n+ 1 LongSparseArray.jvm.kt\nandroidx/collection/LongSparseArray\n*L\n92#1:244\n92#1:245,5\n99#1:250,11\n103#1:261,8\n106#1:269,8\n115#1:277,9\n118#1:286,5\n127#1:291,7\n138#1:298,9\n144#1:307,12\n144#1:319,18\n144#1:337,21\n150#1:358,2\n150#1:361\n161#1:362,5\n164#1:367,2\n164#1:369,18\n164#1:387\n171#1:388\n183#1:389\n183#1:393\n183#1:395,2\n183#1:397,18\n183#1:415\n195#1:416\n195#1:420\n195#1:422,2\n195#1:424,18\n195#1:442\n203#1:443\n203#1:447\n203#1:449,2\n203#1:451,18\n203#1:469,2\n209#1:471,2\n209#1:473,18\n209#1:491\n218#1:492,2\n218#1:494,18\n218#1:512,6\n221#1:518\n224#1:519\n227#1:520,8\n233#1:528,6\n233#1:534,18\n233#1:552,10\n241#1:562,21\n150#1:360\n183#1:390,3\n183#1:394\n195#1:417,3\n195#1:421\n203#1:444,3\n203#1:448\n*E\n"})
|
|
/* loaded from: classes.dex */
|
|
public class LongSparseArray<E> implements Cloneable {
|
|
|
|
@JvmField
|
|
public /* synthetic */ boolean garbage;
|
|
|
|
@JvmField
|
|
public /* synthetic */ long[] keys;
|
|
|
|
@JvmField
|
|
public /* synthetic */ int size;
|
|
|
|
@JvmField
|
|
public /* synthetic */ Object[] values;
|
|
|
|
@JvmOverloads
|
|
public LongSparseArray(int i) {
|
|
if (i == 0) {
|
|
this.keys = ContainerHelpersKt.EMPTY_LONGS;
|
|
this.values = ContainerHelpersKt.EMPTY_OBJECTS;
|
|
} else {
|
|
int idealLongArraySize = ContainerHelpersKt.idealLongArraySize(i);
|
|
this.keys = new long[idealLongArraySize];
|
|
this.values = new Object[idealLongArraySize];
|
|
}
|
|
}
|
|
|
|
public void append(long key, E value) {
|
|
int i = this.size;
|
|
if (i != 0 && key <= this.keys[i - 1]) {
|
|
put(key, value);
|
|
return;
|
|
}
|
|
if (this.garbage) {
|
|
long[] jArr = this.keys;
|
|
if (i >= jArr.length) {
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
}
|
|
int i4 = this.size;
|
|
if (i4 >= this.keys.length) {
|
|
int idealLongArraySize = ContainerHelpersKt.idealLongArraySize(i4 + 1);
|
|
this.keys = Arrays.copyOf(this.keys, idealLongArraySize);
|
|
this.values = Arrays.copyOf(this.values, idealLongArraySize);
|
|
}
|
|
this.keys[i4] = key;
|
|
this.values[i4] = value;
|
|
this.size = i4 + 1;
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
@NotNull
|
|
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
|
public LongSparseArray<E> m216clone() {
|
|
Object clone = super.clone();
|
|
clone.getClass();
|
|
LongSparseArray<E> longSparseArray = (LongSparseArray) clone;
|
|
longSparseArray.keys = (long[]) this.keys.clone();
|
|
longSparseArray.values = (Object[]) this.values.clone();
|
|
return longSparseArray;
|
|
}
|
|
|
|
public boolean containsKey(long key) {
|
|
return indexOfKey(key) >= 0;
|
|
}
|
|
|
|
public boolean containsValue(E value) {
|
|
return indexOfValue(value) >= 0;
|
|
}
|
|
|
|
@Deprecated(message = "Alias for `remove(key)`.", replaceWith = @ReplaceWith(expression = "remove(key)", imports = {}))
|
|
public void delete(long key) {
|
|
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
if (binarySearch < 0 || this.values[binarySearch] == LongSparseArrayKt.DELETED) {
|
|
return;
|
|
}
|
|
this.values[binarySearch] = LongSparseArrayKt.DELETED;
|
|
this.garbage = true;
|
|
}
|
|
|
|
@Nullable
|
|
public E get(long key) {
|
|
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
if (binarySearch < 0 || this.values[binarySearch] == LongSparseArrayKt.DELETED) {
|
|
return null;
|
|
}
|
|
return (E) this.values[binarySearch];
|
|
}
|
|
|
|
public int indexOfKey(long key) {
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
return ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
}
|
|
|
|
public int indexOfValue(E value) {
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
int i4 = this.size;
|
|
for (int i5 = 0; i5 < i4; i5++) {
|
|
if (this.values[i5] == value) {
|
|
return i5;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
return size() == 0;
|
|
}
|
|
|
|
public long keyAt(int index) {
|
|
if (!(index >= 0 && index < this.size)) {
|
|
RuntimeHelpersKt.throwIllegalArgumentException("Expected index to be within 0..size()-1, but was " + index);
|
|
}
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
return this.keys[index];
|
|
}
|
|
|
|
public void put(long key, E value) {
|
|
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
if (binarySearch >= 0) {
|
|
this.values[binarySearch] = value;
|
|
return;
|
|
}
|
|
int i = ~binarySearch;
|
|
if (i < this.size && this.values[i] == LongSparseArrayKt.DELETED) {
|
|
this.keys[i] = key;
|
|
this.values[i] = value;
|
|
return;
|
|
}
|
|
if (this.garbage) {
|
|
int i2 = this.size;
|
|
long[] jArr = this.keys;
|
|
if (i2 >= jArr.length) {
|
|
Object[] objArr = this.values;
|
|
int i3 = 0;
|
|
for (int i4 = 0; i4 < i2; i4++) {
|
|
Object obj = objArr[i4];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i4 != i3) {
|
|
jArr[i3] = jArr[i4];
|
|
objArr[i3] = obj;
|
|
objArr[i4] = null;
|
|
}
|
|
i3++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i3;
|
|
i = ~ContainerHelpersKt.binarySearch(this.keys, i3, key);
|
|
}
|
|
}
|
|
int i5 = this.size;
|
|
if (i5 >= this.keys.length) {
|
|
int idealLongArraySize = ContainerHelpersKt.idealLongArraySize(i5 + 1);
|
|
this.keys = Arrays.copyOf(this.keys, idealLongArraySize);
|
|
this.values = Arrays.copyOf(this.values, idealLongArraySize);
|
|
}
|
|
int i6 = this.size;
|
|
if (i6 - i != 0) {
|
|
long[] jArr2 = this.keys;
|
|
int i7 = i + 1;
|
|
ArraysKt___ArraysJvmKt.copyInto(jArr2, jArr2, i7, i, i6);
|
|
Object[] objArr2 = this.values;
|
|
ArraysKt.copyInto(objArr2, objArr2, i7, i, this.size);
|
|
}
|
|
this.keys[i] = key;
|
|
this.values[i] = value;
|
|
this.size++;
|
|
}
|
|
|
|
public void putAll(@NotNull LongSparseArray<? extends E> other) {
|
|
other.getClass();
|
|
int size = other.size();
|
|
for (int i = 0; i < size; i++) {
|
|
put(other.keyAt(i), other.valueAt(i));
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
public E putIfAbsent(long key, E value) {
|
|
E e = get(key);
|
|
if (e == null) {
|
|
put(key, value);
|
|
}
|
|
return e;
|
|
}
|
|
|
|
public void remove(long key) {
|
|
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
if (binarySearch < 0 || this.values[binarySearch] == LongSparseArrayKt.DELETED) {
|
|
return;
|
|
}
|
|
this.values[binarySearch] = LongSparseArrayKt.DELETED;
|
|
this.garbage = true;
|
|
}
|
|
|
|
public void removeAt(int index) {
|
|
if (this.values[index] != LongSparseArrayKt.DELETED) {
|
|
this.values[index] = LongSparseArrayKt.DELETED;
|
|
this.garbage = true;
|
|
}
|
|
}
|
|
|
|
public boolean replace(long key, E oldValue, E newValue) {
|
|
int indexOfKey = indexOfKey(key);
|
|
if (indexOfKey < 0 || !Intrinsics.areEqual(this.values[indexOfKey], oldValue)) {
|
|
return false;
|
|
}
|
|
this.values[indexOfKey] = newValue;
|
|
return true;
|
|
}
|
|
|
|
public void setValueAt(int index, E value) {
|
|
if (!(index >= 0 && index < this.size)) {
|
|
RuntimeHelpersKt.throwIllegalArgumentException("Expected index to be within 0..size()-1, but was " + index);
|
|
}
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
this.values[index] = value;
|
|
}
|
|
|
|
public int size() {
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
return this.size;
|
|
}
|
|
|
|
@NotNull
|
|
public String toString() {
|
|
if (size() <= 0) {
|
|
return "{}";
|
|
}
|
|
StringBuilder sb = new StringBuilder(this.size * 28);
|
|
sb.append(AbstractJsonLexerKt.BEGIN_OBJ);
|
|
int i = this.size;
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
if (i2 > 0) {
|
|
sb.append(", ");
|
|
}
|
|
sb.append(keyAt(i2));
|
|
sb.append('=');
|
|
E valueAt = valueAt(i2);
|
|
if (valueAt != sb) {
|
|
sb.append(valueAt);
|
|
} else {
|
|
sb.append("(this Map)");
|
|
}
|
|
}
|
|
sb.append(AbstractJsonLexerKt.END_OBJ);
|
|
return sb.toString();
|
|
}
|
|
|
|
public E valueAt(int index) {
|
|
if (!(index >= 0 && index < this.size)) {
|
|
RuntimeHelpersKt.throwIllegalArgumentException("Expected index to be within 0..size()-1, but was " + index);
|
|
}
|
|
if (this.garbage) {
|
|
int i = this.size;
|
|
long[] jArr = this.keys;
|
|
Object[] objArr = this.values;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
Object obj = objArr[i3];
|
|
if (obj != LongSparseArrayKt.DELETED) {
|
|
if (i3 != i2) {
|
|
jArr[i2] = jArr[i3];
|
|
objArr[i2] = obj;
|
|
objArr[i3] = null;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.garbage = false;
|
|
this.size = i2;
|
|
}
|
|
return (E) this.values[index];
|
|
}
|
|
|
|
@Nullable
|
|
public E replace(long key, E value) {
|
|
int indexOfKey = indexOfKey(key);
|
|
if (indexOfKey < 0) {
|
|
return null;
|
|
}
|
|
Object[] objArr = this.values;
|
|
E e = (E) objArr[indexOfKey];
|
|
objArr[indexOfKey] = value;
|
|
return e;
|
|
}
|
|
|
|
@JvmOverloads
|
|
public LongSparseArray() {
|
|
this(0, 1, null);
|
|
}
|
|
|
|
public /* synthetic */ LongSparseArray(int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this((i2 & 1) != 0 ? 10 : i);
|
|
}
|
|
|
|
public E get(long key, E defaultValue) {
|
|
int binarySearch = ContainerHelpersKt.binarySearch(this.keys, this.size, key);
|
|
return (binarySearch < 0 || this.values[binarySearch] == LongSparseArrayKt.DELETED) ? defaultValue : (E) this.values[binarySearch];
|
|
}
|
|
|
|
public boolean remove(long key, E value) {
|
|
int indexOfKey = indexOfKey(key);
|
|
if (indexOfKey < 0 || !Intrinsics.areEqual(value, valueAt(indexOfKey))) {
|
|
return false;
|
|
}
|
|
removeAt(indexOfKey);
|
|
return true;
|
|
}
|
|
}
|