package o1;

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: renamed from: o1.b, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public abstract class AbstractC0666b extends AbstractC0665a implements List, z1.a {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public static final a f5993b = new a(null);

    /* JADX INFO: renamed from: o1.b$a */
    public static final class a {
        public /* synthetic */ a(kotlin.jvm.internal.g gVar) {
            this();
        }

        public final void a(int i2, int i3) {
            if (i2 < 0 || i2 >= i3) {
                throw new IndexOutOfBoundsException("index: " + i2 + ", size: " + i3);
            }
        }

        public final void b(int i2, int i3) {
            if (i2 < 0 || i2 > i3) {
                throw new IndexOutOfBoundsException("index: " + i2 + ", size: " + i3);
            }
        }

        public final void c(int i2, int i3, int i4) {
            if (i2 < 0 || i3 > i4) {
                throw new IndexOutOfBoundsException("fromIndex: " + i2 + ", toIndex: " + i3 + ", size: " + i4);
            }
            if (i2 <= i3) {
                return;
            }
            throw new IllegalArgumentException("fromIndex: " + i2 + " > toIndex: " + i3);
        }

        public final boolean d(Collection c2, Collection other) {
            kotlin.jvm.internal.l.e(c2, "c");
            kotlin.jvm.internal.l.e(other, "other");
            if (c2.size() != other.size()) {
                return false;
            }
            Iterator it = other.iterator();
            Iterator it2 = c2.iterator();
            while (it2.hasNext()) {
                if (!kotlin.jvm.internal.l.a(it2.next(), it.next())) {
                    return false;
                }
            }
            return true;
        }

        public final int e(Collection c2) {
            kotlin.jvm.internal.l.e(c2, "c");
            Iterator it = c2.iterator();
            int iHashCode = 1;
            while (it.hasNext()) {
                Object next = it.next();
                iHashCode = (iHashCode * 31) + (next != null ? next.hashCode() : 0);
            }
            return iHashCode;
        }

        private a() {
        }
    }

    /* JADX INFO: renamed from: o1.b$b, reason: collision with other inner class name */
    private class C0086b implements Iterator, z1.a {

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

        public C0086b() {
        }

        protected final int a() {
            return this.f5994b;
        }

        protected final void b(int i2) {
            this.f5994b = i2;
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.f5994b < AbstractC0666b.this.size();
        }

        @Override // java.util.Iterator
        public Object next() {
            if (!hasNext()) {
                throw new NoSuchElementException();
            }
            AbstractC0666b abstractC0666b = AbstractC0666b.this;
            int i2 = this.f5994b;
            this.f5994b = i2 + 1;
            return abstractC0666b.get(i2);
        }

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

    /* JADX INFO: renamed from: o1.b$c */
    private class c extends C0086b implements ListIterator, z1.a {
        public c(int i2) {
            super();
            AbstractC0666b.f5993b.b(i2, AbstractC0666b.this.size());
            b(i2);
        }

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

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

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

        @Override // java.util.ListIterator
        public Object previous() {
            if (!hasPrevious()) {
                throw new NoSuchElementException();
            }
            AbstractC0666b abstractC0666b = AbstractC0666b.this;
            b(a() - 1);
            return abstractC0666b.get(a());
        }

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

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

    /* JADX INFO: renamed from: o1.b$d */
    private static final class d extends AbstractC0666b implements RandomAccess {

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        private final AbstractC0666b f5997g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        private final int f5998r;

        /* JADX INFO: renamed from: x, reason: collision with root package name */
        private int f5999x;

        public d(AbstractC0666b list, int i2, int i3) {
            kotlin.jvm.internal.l.e(list, "list");
            this.f5997g = list;
            this.f5998r = i2;
            AbstractC0666b.f5993b.c(i2, i3, list.size());
            this.f5999x = i3 - i2;
        }

        @Override // o1.AbstractC0665a
        public int a() {
            return this.f5999x;
        }

        @Override // o1.AbstractC0666b, java.util.List
        public Object get(int i2) {
            AbstractC0666b.f5993b.a(i2, this.f5999x);
            return this.f5997g.get(this.f5998r + i2);
        }
    }

    protected AbstractC0666b() {
    }

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

    @Override // java.util.List
    public boolean addAll(int i2, Collection 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 f5993b.d(this, (Collection) obj);
        }
        return false;
    }

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

    @Override // java.util.Collection, java.util.List
    public int hashCode() {
        return f5993b.e(this);
    }

    @Override // java.util.List
    public int indexOf(Object obj) {
        Iterator it = iterator();
        int i2 = 0;
        while (it.hasNext()) {
            if (kotlin.jvm.internal.l.a(it.next(), obj)) {
                return i2;
            }
            i2++;
        }
        return -1;
    }

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

    @Override // java.util.List
    public int lastIndexOf(Object obj) {
        ListIterator listIterator = listIterator(size());
        while (listIterator.hasPrevious()) {
            if (kotlin.jvm.internal.l.a(listIterator.previous(), obj)) {
                return listIterator.nextIndex();
            }
        }
        return -1;
    }

    @Override // java.util.List
    public ListIterator listIterator() {
        return new c(0);
    }

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

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

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

    @Override // java.util.List
    public ListIterator listIterator(int i2) {
        return new c(i2);
    }
}
