package o; import java.util.AbstractList; import java.util.Arrays; import java.util.RandomAccess; import o.oZe; /* loaded from: classes2.dex */ public final class Fhc extends kOJ implements RandomAccess { private static final Fhc d; private int a; private E[] c; @Override // o.oZe.tOB, o.oZe.jbe public final /* synthetic */ oZe.tOB c(int i) { if (i < this.a) { throw new IllegalArgumentException(); } return new Fhc(Arrays.copyOf(this.c, i), this.a); } static { Fhc fhc = new Fhc<>(new Object[0], 0); d = fhc; fhc.d(); } Fhc() { this(new Object[10], 0); } private Fhc(E[] eArr, int i) { this.c = eArr; this.a = i; } @Override // o.kOJ, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean add(E e) { c(); int i = this.a; E[] eArr = this.c; if (i == eArr.length) { this.c = (E[]) Arrays.copyOf(eArr, ((i * 3) / 2) + 1); } E[] eArr2 = this.c; int i2 = this.a; this.a = i2 + 1; eArr2[i2] = e; ((AbstractList) this).modCount++; return true; } @Override // o.kOJ, java.util.AbstractList, java.util.List public final void add(int i, E e) { int i2; c(); if (i >= 0 && i <= (i2 = this.a)) { E[] eArr = this.c; if (i2 < eArr.length) { System.arraycopy(eArr, i, eArr, i + 1, i2 - i); } else { E[] eArr2 = (E[]) new Object[((i2 * 3) / 2) + 1]; System.arraycopy(eArr, 0, eArr2, 0, i); System.arraycopy(this.c, i, eArr2, i + 1, this.a - i); this.c = eArr2; } this.c[i] = e; this.a++; ((AbstractList) this).modCount++; return; } StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.a); throw new IndexOutOfBoundsException(sb.toString()); } @Override // java.util.AbstractList, java.util.List public final E get(int i) { e(i); return this.c[i]; } @Override // o.kOJ, java.util.AbstractList, java.util.List public final E remove(int i) { c(); e(i); E[] eArr = this.c; E e = eArr[i]; if (i < this.a - 1) { System.arraycopy(eArr, i + 1, eArr, i, (r2 - i) - 1); } this.a--; ((AbstractList) this).modCount++; return e; } @Override // o.kOJ, java.util.AbstractList, java.util.List public final E set(int i, E e) { c(); e(i); E[] eArr = this.c; E e2 = eArr[i]; eArr[i] = e; ((AbstractList) this).modCount++; return e2; } private void e(int i) { if (i < 0 || i >= this.a) { StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.a); throw new IndexOutOfBoundsException(sb.toString()); } } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.a; } public static Fhc b() { return (Fhc) d; } }