- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
43 lines
1.4 KiB
Java
43 lines
1.4 KiB
Java
package kotlinx.coroutines.internal;
|
|
|
|
import java.util.concurrent.atomic.AtomicReferenceArray;
|
|
import kotlin.ranges.RangesKt___RangesKt;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public final class ResizableAtomicArray {
|
|
private volatile AtomicReferenceArray<Object> array;
|
|
|
|
public ResizableAtomicArray(int i) {
|
|
this.array = new AtomicReferenceArray<>(i);
|
|
}
|
|
|
|
public final int currentLength() {
|
|
return this.array.length();
|
|
}
|
|
|
|
public final Object get(int i) {
|
|
AtomicReferenceArray<Object> atomicReferenceArray = this.array;
|
|
if (i < atomicReferenceArray.length()) {
|
|
return atomicReferenceArray.get(i);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final void setSynchronized(int i, Object obj) {
|
|
int coerceAtLeast;
|
|
AtomicReferenceArray<Object> atomicReferenceArray = this.array;
|
|
int length = atomicReferenceArray.length();
|
|
if (i < length) {
|
|
atomicReferenceArray.set(i, obj);
|
|
return;
|
|
}
|
|
coerceAtLeast = RangesKt___RangesKt.coerceAtLeast(i + 1, length * 2);
|
|
AtomicReferenceArray<Object> atomicReferenceArray2 = new AtomicReferenceArray<>(coerceAtLeast);
|
|
for (int i2 = 0; i2 < length; i2++) {
|
|
atomicReferenceArray2.set(i2, atomicReferenceArray.get(i2));
|
|
}
|
|
atomicReferenceArray2.set(i, obj);
|
|
this.array = atomicReferenceArray2;
|
|
}
|
|
}
|