package o; import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; import o.MTP; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public final class Rjv extends AbstractC15969jyR implements MTP.Sts, RandomAccess, VAu { private static final Rjv d; int[] a; private int e; @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { int i2; int intValue = ((Integer) obj).intValue(); d(); if (i >= 0 && i <= (i2 = this.e)) { int[] iArr = this.a; if (i2 < iArr.length) { System.arraycopy(iArr, i, iArr, i + 1, i2 - i); } else { int[] iArr2 = new int[((i2 * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i); System.arraycopy(this.a, i, iArr2, i + 1, this.e - i); this.a = iArr2; } this.a[i] = intValue; this.e++; ((AbstractList) this).modCount++; return; } StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.e); throw new IndexOutOfBoundsException(sb.toString()); } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List public final /* synthetic */ boolean add(Object obj) { a(((Integer) obj).intValue()); return true; } @Override // o.MTP.RVV public final /* synthetic */ MTP.RVV b(int i) { if (i < this.e) { throw new IllegalArgumentException(); } return new Rjv(Arrays.copyOf(this.a, i), this.e); } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { int intValue = ((Integer) obj).intValue(); d(); c(i); int[] iArr = this.a; int i2 = iArr[i]; iArr[i] = intValue; return Integer.valueOf(i2); } static { Rjv rjv = new Rjv(new int[0], 0); d = rjv; rjv.a(); } Rjv() { this(new int[10], 0); } private Rjv(int[] iArr, int i) { this.a = iArr; this.e = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { d(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } int[] iArr = this.a; System.arraycopy(iArr, i2, iArr, i, this.e - i2); this.e -= i2 - i; ((AbstractList) this).modCount++; } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof Rjv)) { return super.equals(obj); } Rjv rjv = (Rjv) obj; if (this.e != rjv.e) { return false; } int[] iArr = rjv.a; for (int i = 0; i < this.e; i++) { if (this.a[i] != iArr[i]) { return false; } } return true; } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.Collection, java.util.List public final int hashCode() { int i = 1; for (int i2 = 0; i2 < this.e; i2++) { i = (i * 31) + this.a[i2]; } return i; } @Override // java.util.AbstractList, java.util.List public final int indexOf(Object obj) { if (!(obj instanceof Integer)) { return -1; } int intValue = ((Integer) obj).intValue(); int size = size(); for (int i = 0; i < size; i++) { if (this.a[i] == intValue) { return i; } } return -1; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean contains(Object obj) { return indexOf(obj) != -1; } public final void a(int i) { d(); int i2 = this.e; int[] iArr = this.a; if (i2 == iArr.length) { int[] iArr2 = new int[((i2 * 3) / 2) + 1]; System.arraycopy(iArr, 0, iArr2, 0, i2); this.a = iArr2; } int[] iArr3 = this.a; int i3 = this.e; this.e = i3 + 1; iArr3[i3] = i; } @Override // o.AbstractC15969jyR, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { d(); MTP.d(collection); if (!(collection instanceof Rjv)) { return super.addAll(collection); } Rjv rjv = (Rjv) collection; int i = rjv.e; if (i == 0) { return false; } int i2 = this.e; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; int[] iArr = this.a; if (i3 > iArr.length) { this.a = Arrays.copyOf(iArr, i3); } System.arraycopy(rjv.a, 0, this.a, this.e, rjv.e); this.e = i3; ((AbstractList) this).modCount++; return true; } /* JADX INFO: Access modifiers changed from: package-private */ public final void c(int i) { if (i < 0 || i >= this.e) { StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.e); throw new IndexOutOfBoundsException(sb.toString()); } } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { c(i); return Integer.valueOf(this.a[i]); } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { d(); c(i); int[] iArr = this.a; int i2 = iArr[i]; if (i < this.e - 1) { System.arraycopy(iArr, i + 1, iArr, i, (r2 - i) - 1); } this.e--; ((AbstractList) this).modCount++; return Integer.valueOf(i2); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.e; } public static Rjv c() { return d; } }