package g.c0;

import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import java.util.RandomAccess;

/* JADX INFO: compiled from: AbstractList.kt */
/* JADX INFO: loaded from: classes.dex */
@g.i
public abstract class b<E> extends g.c0.a<E> implements List<E>, g.h0.c.g0.a {

    /* JADX INFO: compiled from: AbstractList.kt */
    @g.i
    public class a implements Iterator<E>, g.h0.c.g0.a {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public int f4053b;

        public a() {
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.f4053b < b.this.b();
        }

        @Override // java.util.Iterator
        public E next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            b<E> bVar = b.this;
            int i2 = this.f4053b;
            this.f4053b = i2 + 1;
            return bVar.get(i2);
        }

        @Override // java.util.Iterator
        public void remove() {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    /* JADX INFO: renamed from: g.c0.b$b, reason: collision with other inner class name */
    /* JADX INFO: compiled from: AbstractList.kt */
    @g.i
    public class C0076b extends b<E>.a implements ListIterator<E>, g.h0.c.g0.a {
        public C0076b(int i2) {
            super();
            int iB = b.this.b();
            if (i2 < 0 || i2 > iB) {
                throw new IndexOutOfBoundsException(d.b.a.a.a.k("index: ", i2, ", size: ", iB));
            }
            this.f4053b = i2;
        }

        @Override // java.util.ListIterator
        public void add(E e2) {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }

        @Override // java.util.ListIterator
        public boolean hasPrevious() {
            return this.f4053b > 0;
        }

        @Override // java.util.ListIterator
        public int nextIndex() {
            return this.f4053b;
        }

        @Override // java.util.ListIterator
        public E previous() {
            if (!hasPrevious()) {
                throw new NoSuchElementException();
            }
            b<E> bVar = b.this;
            int i2 = this.f4053b - 1;
            this.f4053b = i2;
            return bVar.get(i2);
        }

        @Override // java.util.ListIterator
        public int previousIndex() {
            return this.f4053b - 1;
        }

        @Override // java.util.ListIterator
        public void set(E e2) {
            throw new UnsupportedOperationException("Operation is not supported for read-only collection");
        }
    }

    /* JADX INFO: compiled from: AbstractList.kt */
    @g.i
    public static final class c<E> extends b<E> implements RandomAccess {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        public final b<E> f4056b;

        /* JADX INFO: renamed from: e, reason: collision with root package name */
        public final int f4057e;

        /* JADX INFO: renamed from: f, reason: collision with root package name */
        public int f4058f;

        /* JADX WARN: Multi-variable type inference failed */
        public c(b<? extends E> bVar, int i2, int i3) {
            g.h0.c.l.f(bVar, "list");
            this.f4056b = bVar;
            this.f4057e = i2;
            int iB = bVar.b();
            if (i2 >= 0 && i3 <= iB) {
                if (i2 > i3) {
                    throw new IllegalArgumentException(d.b.a.a.a.k("fromIndex: ", i2, " > toIndex: ", i3));
                }
                this.f4058f = i3 - i2;
                return;
            }
            throw new IndexOutOfBoundsException("fromIndex: " + i2 + ", toIndex: " + i3 + ", size: " + iB);
        }

        @Override // g.c0.a
        public int b() {
            return this.f4058f;
        }

        @Override // g.c0.b, java.util.List
        public E get(int i2) {
            int i3 = this.f4058f;
            if (i2 < 0 || i2 >= i3) {
                throw new IndexOutOfBoundsException(d.b.a.a.a.k("index: ", i2, ", size: ", i3));
            }
            return this.f4056b.get(this.f4057e + i2);
        }
    }

    @Override // java.util.List
    public void add(int i2, E e2) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.List
    public boolean addAll(int i2, Collection<? extends E> collection) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.Collection, java.util.List
    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (!(obj instanceof List)) {
            return false;
        }
        Collection collection = (Collection) obj;
        g.h0.c.l.f(this, "c");
        g.h0.c.l.f(collection, "other");
        if (size() == collection.size()) {
            Iterator<E> it = collection.iterator();
            Iterator<E> it2 = iterator();
            while (it2.hasNext()) {
                if (!g.h0.c.l.a(it2.next(), it.next())) {
                }
            }
            return true;
        }
        return false;
    }

    @Override // java.util.List
    public abstract E get(int i2);

    @Override // java.util.Collection, java.util.List
    public int hashCode() {
        g.h0.c.l.f(this, "c");
        Iterator<E> it = iterator();
        int iHashCode = 1;
        while (it.hasNext()) {
            E next = it.next();
            iHashCode = (iHashCode * 31) + (next != null ? next.hashCode() : 0);
        }
        return iHashCode;
    }

    @Override // java.util.List
    public int indexOf(E e2) {
        Iterator<E> it = iterator();
        int i2 = 0;
        while (it.hasNext()) {
            if (g.h0.c.l.a(it.next(), e2)) {
                return i2;
            }
            i2++;
        }
        return -1;
    }

    @Override // java.util.Collection, java.lang.Iterable, java.util.List
    public Iterator<E> iterator() {
        return new a();
    }

    @Override // java.util.List
    public int lastIndexOf(E e2) {
        ListIterator<E> listIterator = listIterator(size());
        while (listIterator.hasPrevious()) {
            if (g.h0.c.l.a(listIterator.previous(), e2)) {
                return listIterator.nextIndex();
            }
        }
        return -1;
    }

    @Override // java.util.List
    public ListIterator<E> listIterator() {
        return new C0076b(0);
    }

    @Override // java.util.List
    public E remove(int i2) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.List
    public E set(int i2, E e2) {
        throw new UnsupportedOperationException("Operation is not supported for read-only collection");
    }

    @Override // java.util.List
    public List<E> subList(int i2, int i3) {
        return new c(this, i2, i3);
    }

    @Override // java.util.List
    public ListIterator<E> listIterator(int i2) {
        return new C0076b(i2);
    }
}
