package o; import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; import o.MTP; /* loaded from: classes2.dex */ final class Wqp extends AbstractC15969jyR implements InterfaceC1067Uwv, RandomAccess, VAu { private double[] c; private int e; @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { int i2; double doubleValue = ((Double) obj).doubleValue(); d(); if (i >= 0 && i <= (i2 = this.e)) { double[] dArr = this.c; if (i2 < dArr.length) { System.arraycopy(dArr, i, dArr, i + 1, i2 - i); } else { double[] dArr2 = new double[((i2 * 3) / 2) + 1]; System.arraycopy(dArr, 0, dArr2, 0, i); System.arraycopy(this.c, i, dArr2, i + 1, this.e - i); this.c = dArr2; } this.c[i] = doubleValue; 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) { c(((Double) obj).doubleValue()); return true; } @Override // o.MTP.RVV public final /* synthetic */ MTP.RVV b(int i) { if (i < this.e) { throw new IllegalArgumentException(); } return new Wqp(Arrays.copyOf(this.c, i), this.e); } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { double doubleValue = ((Double) obj).doubleValue(); d(); e(i); double[] dArr = this.c; double d = dArr[i]; dArr[i] = doubleValue; return Double.valueOf(d); } static { new Wqp(new double[0], 0).a(); } Wqp() { this(new double[10], 0); } private Wqp(double[] dArr, int i) { this.c = dArr; this.e = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { d(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } double[] dArr = this.c; System.arraycopy(dArr, i2, dArr, 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 Wqp)) { return super.equals(obj); } Wqp wqp = (Wqp) obj; if (this.e != wqp.e) { return false; } double[] dArr = wqp.c; for (int i = 0; i < this.e; i++) { if (Double.doubleToLongBits(this.c[i]) != Double.doubleToLongBits(dArr[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) + MTP.b(Double.doubleToLongBits(this.c[i2])); } return i; } @Override // java.util.AbstractList, java.util.List public final int indexOf(Object obj) { if (!(obj instanceof Double)) { return -1; } double doubleValue = ((Double) obj).doubleValue(); int size = size(); for (int i = 0; i < size; i++) { if (this.c[i] == doubleValue) { 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 c(double d) { d(); int i = this.e; double[] dArr = this.c; if (i == dArr.length) { double[] dArr2 = new double[((i * 3) / 2) + 1]; System.arraycopy(dArr, 0, dArr2, 0, i); this.c = dArr2; } double[] dArr3 = this.c; int i2 = this.e; this.e = i2 + 1; dArr3[i2] = d; } @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 Wqp)) { return super.addAll(collection); } Wqp wqp = (Wqp) collection; int i = wqp.e; if (i == 0) { return false; } int i2 = this.e; if (Integer.MAX_VALUE - i2 < i) { throw new OutOfMemoryError(); } int i3 = i2 + i; double[] dArr = this.c; if (i3 > dArr.length) { this.c = Arrays.copyOf(dArr, i3); } System.arraycopy(wqp.c, 0, this.c, this.e, wqp.e); this.e = i3; ((AbstractList) this).modCount++; return true; } private void e(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) { e(i); return Double.valueOf(this.c[i]); } @Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { d(); e(i); double[] dArr = this.c; double d = dArr[i]; if (i < this.e - 1) { System.arraycopy(dArr, i + 1, dArr, i, (r3 - i) - 1); } this.e--; ((AbstractList) this).modCount++; return Double.valueOf(d); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.e; } }