package o;

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 */
/* renamed from: o.fo0, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public abstract class AbstractC1229fo0 extends Vn0 implements List, RandomAccess {
    public static final Zn0 m = new Zn0(C1706ko0.p, 0);

    public static C1706ko0 h(int i, Object[] objArr) {
        return i == 0 ? C1706ko0.p : new C1706ko0(i, objArr);
    }

    public static AbstractC1229fo0 i(Iterable iterable) {
        iterable.getClass();
        if (iterable instanceof Collection) {
            return k((Collection) iterable);
        }
        Iterator it = iterable.iterator();
        if (!it.hasNext()) {
            return C1706ko0.p;
        }
        Object next = it.next();
        if (!it.hasNext()) {
            Object[] objArr = {next};
            AbstractC2461sm0.G(1, objArr);
            return h(1, objArr);
        }
        C1535j c1535j = new C1535j();
        c1535j.c = new Object[4];
        c1535j.a = 0;
        c1535j.d(next);
        while (it.hasNext()) {
            c1535j.d(it.next());
        }
        c1535j.b = true;
        return h(c1535j.a, (Object[]) c1535j.c);
    }

    public static AbstractC1229fo0 k(Collection collection) {
        if (!(collection instanceof Vn0)) {
            Object[] array = collection.toArray();
            int length = array.length;
            AbstractC2461sm0.G(length, array);
            return h(length, array);
        }
        AbstractC1229fo0 abstractC1229fo0 = (AbstractC1229fo0) ((Vn0) collection);
        if (!abstractC1229fo0.d()) {
            return abstractC1229fo0;
        }
        Object[] array2 = abstractC1229fo0.toArray(Vn0.l);
        return h(array2.length, array2);
    }

    @Override // o.Vn0
    public int a(Object[] objArr) {
        int size = size();
        for (int i = 0; i < size; i++) {
            objArr[i] = get(i);
        }
        return size;
    }

    @Override // java.util.List
    public final void add(int i, Object obj) {
        throw new UnsupportedOperationException();
    }

    @Override // java.util.List
    public final boolean addAll(int i, Collection collection) {
        throw new UnsupportedOperationException();
    }

    @Override // java.util.AbstractCollection, java.util.Collection, java.util.List
    public final boolean contains(Object obj) {
        return indexOf(obj) >= 0;
    }

    @Override // java.util.Collection, java.util.List
    public final boolean equals(Object obj) {
        Object next;
        Object next2;
        if (obj == this) {
            return true;
        }
        if (obj instanceof List) {
            List list = (List) obj;
            int size = size();
            if (size == list.size()) {
                if (list instanceof RandomAccess) {
                    for (int i = 0; i < size; i++) {
                        Object obj2 = get(i);
                        Object obj3 = list.get(i);
                        if (obj2 == obj3 || (obj2 != null && obj2.equals(obj3))) {
                        }
                    }
                    return true;
                }
                Zn0 zn0ListIterator = listIterator(0);
                Iterator it = list.iterator();
                while (true) {
                    if (zn0ListIterator.hasNext()) {
                        if (!it.hasNext() || ((next = zn0ListIterator.next()) != (next2 = it.next()) && (next == null || !next.equals(next2)))) {
                            break;
                        }
                    } else if (!it.hasNext()) {
                        return true;
                    }
                }
            }
        }
        return false;
    }

    @Override // java.util.List
    /* renamed from: f */
    public AbstractC1229fo0 subList(int i, int i2) {
        AbstractC2798wI.D(i, i2, size());
        int i3 = i2 - i;
        return i3 == size() ? this : i3 == 0 ? C1706ko0.p : new C0942co0(this, i, i3);
    }

    @Override // java.util.Collection, java.util.List
    public final int hashCode() {
        int size = size();
        int iHashCode = 1;
        for (int i = 0; i < size; i++) {
            iHashCode = (iHashCode * 31) + get(i).hashCode();
        }
        return iHashCode;
    }

    @Override // java.util.List
    public final int indexOf(Object obj) {
        if (obj == null) {
            return -1;
        }
        int size = size();
        for (int i = 0; i < size; i++) {
            if (obj.equals(get(i))) {
                return i;
            }
        }
        return -1;
    }

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

    @Override // java.util.List
    /* renamed from: l, reason: merged with bridge method [inline-methods] */
    public final Zn0 listIterator(int i) {
        AbstractC2798wI.C(i, size());
        return isEmpty() ? m : new Zn0(this, i);
    }

    @Override // java.util.List
    public final int lastIndexOf(Object obj) {
        if (obj == null) {
            return -1;
        }
        for (int size = size() - 1; size >= 0; size--) {
            if (obj.equals(get(size))) {
                return size;
            }
        }
        return -1;
    }

    @Override // java.util.List
    public final /* synthetic */ ListIterator listIterator() {
        return listIterator(0);
    }

    @Override // java.util.List
    public final Object remove(int i) {
        throw new UnsupportedOperationException();
    }

    @Override // java.util.List
    public final Object set(int i, Object obj) {
        throw new UnsupportedOperationException();
    }
}
