package o;

import android.os.Parcel;
import android.os.Parcelable;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.RandomAccess;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class H90 implements Parcelable, Ga0, List, RandomAccess, InterfaceC3084zJ {
    public static final Parcelable.Creator<H90> CREATOR = new G90(0);
    public Ea0 l;

    public H90(Y y) {
        AbstractC2220q90 abstractC2220q90K = AbstractC2884x90.k();
        Ea0 ea0 = new Ea0(abstractC2220q90K.g(), y);
        if (!(abstractC2220q90K instanceof WD)) {
            ea0.b = new Ea0(1, y);
        }
        this.l = ea0;
    }

    @Override // o.Ga0
    public final Ia0 a() {
        return this.l;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean add(Object obj) {
        int i;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i = ea0.d;
                y = ea0.c;
            }
            Y yC = y.c(obj);
            if (yC.equals(y)) {
                return false;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i, yC, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return true;
    }

    @Override // java.util.List
    public final boolean addAll(final int i, final Collection collection) {
        return F3.F(this, new OC() { // from class: o.F90
            @Override // o.OC
            public final Object g(Object obj) {
                return Boolean.valueOf(((List) obj).addAll(i, collection));
            }
        });
    }

    @Override // o.Ga0
    public final void c(Ia0 ia0) {
        ia0.b = this.l;
        this.l = (Ea0) ia0;
    }

    @Override // java.util.List, java.util.Collection
    public final void clear() {
        AbstractC2220q90 abstractC2220q90K;
        Ea0 ea0 = this.l;
        synchronized (AbstractC2884x90.c) {
            abstractC2220q90K = AbstractC2884x90.k();
            Ea0 ea02 = (Ea0) AbstractC2884x90.w(ea0, this, abstractC2220q90K);
            synchronized (F3.h) {
                ea02.c = C1555j90.m;
                ea02.d++;
                ea02.e++;
            }
        }
        AbstractC2884x90.n(abstractC2220q90K, this);
    }

    @Override // java.util.List, java.util.Collection
    public final boolean contains(Object obj) {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.contains(obj);
    }

    @Override // java.util.List, java.util.Collection
    public final boolean containsAll(Collection collection) {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.containsAll(collection);
    }

    public final void d(int i, int i2) {
        int i3;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i3 = ea0.d;
                y = ea0.c;
            }
            NW nwE = y.e();
            nwE.subList(i, i2).clear();
            Y yC = nwE.c();
            if (F3.c(yC, y)) {
                return;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i3, yC, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
    }

    @Override // android.os.Parcelable
    public final int describeContents() {
        return 0;
    }

    @Override // java.util.List
    public final Object get(int i) {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.get(i);
    }

    @Override // java.util.List
    public final int indexOf(Object obj) {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.indexOf(obj);
    }

    @Override // java.util.List, java.util.Collection
    public final boolean isEmpty() {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.isEmpty();
    }

    @Override // java.util.List, java.util.Collection, java.lang.Iterable
    public final Iterator iterator() {
        return listIterator();
    }

    @Override // java.util.List
    public final int lastIndexOf(Object obj) {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.lastIndexOf(obj);
    }

    @Override // java.util.List
    public final ListIterator listIterator() {
        return new C1083eF(this, 0);
    }

    @Override // java.util.List
    public final Object remove(int i) {
        int i2;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        Object obj = get(i);
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i2 = ea0.d;
                y = ea0.c;
            }
            Y yH = y.h(i);
            if (yH.equals(y)) {
                break;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i2, yH, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return obj;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean removeAll(Collection collection) {
        int i;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i = ea0.d;
                y = ea0.c;
            }
            y.getClass();
            Y yF = y.f(new X(0, collection));
            if (F3.c(yF, y)) {
                return false;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i, yF, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return true;
    }

    @Override // java.util.List, java.util.Collection
    public final boolean retainAll(Collection collection) {
        return F3.F(this, new X(2, collection));
    }

    @Override // java.util.List
    public final Object set(int i, Object obj) {
        int i2;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        Object obj2 = get(i);
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i2 = ea0.d;
                y = ea0.c;
            }
            Y yI = y.i(i, obj);
            if (yI.equals(y)) {
                break;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i2, yI, false);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return obj2;
    }

    @Override // java.util.List, java.util.Collection
    public final int size() {
        return ((Ea0) AbstractC2884x90.t(this.l, this)).c.a();
    }

    @Override // java.util.List
    public final List subList(int i, int i2) {
        if (!(i >= 0 && i <= i2 && i2 <= size())) {
            AbstractC1102eY.a("fromIndex or toIndex are out of bounds");
        }
        return new C2060ob0(this, i, i2);
    }

    @Override // java.util.List, java.util.Collection
    public final Object[] toArray() {
        return AbstractC1692kh0.P(this);
    }

    public final String toString() {
        return "SnapshotStateList(value=" + ((Ea0) AbstractC2884x90.i(this.l)).c + ")@" + hashCode();
    }

    @Override // android.os.Parcelable
    public final void writeToParcel(Parcel parcel, int i) {
        Y y = ((Ea0) AbstractC2884x90.t(this.l, this)).c;
        int iA = y.a();
        parcel.writeInt(iA);
        for (int i2 = 0; i2 < iA; i2++) {
            parcel.writeValue(y.get(i2));
        }
    }

    @Override // java.util.List, java.util.Collection
    public final boolean addAll(Collection collection) {
        int i;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i = ea0.d;
                y = ea0.c;
            }
            Y yD = y.d(collection);
            if (F3.c(yD, y)) {
                return false;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i, yD, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return true;
    }

    @Override // java.util.List
    public final ListIterator listIterator(int i) {
        return new C1083eF(this, i);
    }

    @Override // java.util.List, java.util.Collection
    public final Object[] toArray(Object[] objArr) {
        return AbstractC1692kh0.Q(this, objArr);
    }

    public H90() {
        this(C1555j90.m);
    }

    @Override // java.util.List
    public final void add(int i, Object obj) {
        int i2;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i2 = ea0.d;
                y = ea0.c;
            }
            Y yB = y.b(i, obj);
            if (yB.equals(y)) {
                return;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i2, yB, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
    }

    @Override // java.util.List, java.util.Collection
    public final boolean remove(Object obj) {
        int i;
        Y y;
        AbstractC2220q90 abstractC2220q90K;
        boolean zF;
        do {
            synchronized (F3.h) {
                Ea0 ea0 = (Ea0) AbstractC2884x90.i(this.l);
                i = ea0.d;
                y = ea0.c;
            }
            int iIndexOf = y.indexOf(obj);
            Y yH = iIndexOf != -1 ? y.h(iIndexOf) : y;
            if (yH.equals(y)) {
                return false;
            }
            Ea0 ea02 = this.l;
            synchronized (AbstractC2884x90.c) {
                abstractC2220q90K = AbstractC2884x90.k();
                zF = F3.f((Ea0) AbstractC2884x90.w(ea02, this, abstractC2220q90K), i, yH, true);
            }
            AbstractC2884x90.n(abstractC2220q90K, this);
        } while (!zF);
        return true;
    }
}
