package kotlinx.coroutines.internal;

import java.util.concurrent.atomic.AtomicReferenceArray;
import p048p1.C1543e;

/* renamed from: kotlinx.coroutines.internal.u */
/* loaded from: classes.dex */
public final class C1382u<T> {
    private volatile AtomicReferenceArray<T> array;

    public C1382u(int i) {
        this.array = new AtomicReferenceArray<>(i);
    }

    /* renamed from: a */
    public final int m1484a() {
        return this.array.length();
    }

    /* renamed from: b */
    public final T m1483b(int i) {
        AtomicReferenceArray<T> atomicReferenceArray = this.array;
        if (i < atomicReferenceArray.length()) {
            return atomicReferenceArray.get(i);
        }
        return null;
    }

    /* renamed from: c */
    public final void m1482c(int i, T t) {
        AtomicReferenceArray<T> atomicReferenceArray = this.array;
        int length = atomicReferenceArray.length();
        if (i < length) {
            atomicReferenceArray.set(i, t);
            return;
        }
        AtomicReferenceArray<T> atomicReferenceArray2 = new AtomicReferenceArray<>(C1543e.m1092a(i + 1, length * 2));
        for (int i2 = 0; i2 < length; i2++) {
            atomicReferenceArray2.set(i2, atomicReferenceArray.get(i2));
        }
        atomicReferenceArray2.set(i, t);
        this.array = atomicReferenceArray2;
    }
}