package o; import java.util.AbstractList; import java.util.Arrays; import java.util.Collection; import java.util.RandomAccess; import o.oZe; /* loaded from: classes2.dex */ final class WRU extends kOJ implements oZe.IeS, RandomAccess, vjv { private int b; private double[] c; @Override // o.kOJ, java.util.AbstractList, java.util.List public final /* synthetic */ void add(int i, Object obj) { int i2; double doubleValue = ((Double) obj).doubleValue(); c(); if (i >= 0 && i <= (i2 = this.b)) { 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.b - i); this.c = dArr2; } this.c[i] = doubleValue; this.b++; ((AbstractList) this).modCount++; return; } StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.b); throw new IndexOutOfBoundsException(sb.toString()); } @Override // o.kOJ, 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.kOJ, java.util.AbstractList, java.util.List public final /* synthetic */ Object set(int i, Object obj) { double doubleValue = ((Double) obj).doubleValue(); c(); d(i); double[] dArr = this.c; double d = dArr[i]; dArr[i] = doubleValue; return Double.valueOf(d); } static { new WRU(new double[0], 0).d(); } WRU() { this(new double[10], 0); } private WRU(double[] dArr, int i) { this.c = dArr; this.b = i; } @Override // java.util.AbstractList protected final void removeRange(int i, int i2) { c(); if (i2 < i) { throw new IndexOutOfBoundsException("toIndex < fromIndex"); } double[] dArr = this.c; System.arraycopy(dArr, i2, dArr, i, this.b - i2); this.b -= i2 - i; ((AbstractList) this).modCount++; } @Override // o.kOJ, java.util.AbstractList, java.util.Collection, java.util.List public final boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof WRU)) { return super.equals(obj); } WRU wru = (WRU) obj; if (this.b != wru.b) { return false; } double[] dArr = wru.c; for (int i = 0; i < this.b; i++) { if (Double.doubleToLongBits(this.c[i]) != Double.doubleToLongBits(dArr[i])) { return false; } } return true; } @Override // o.kOJ, java.util.AbstractList, java.util.Collection, java.util.List public final int hashCode() { int i = 1; for (int i2 = 0; i2 < this.b; i2++) { i = (i * 31) + oZe.e(Double.doubleToLongBits(this.c[i2])); } return i; } @Override // o.oZe.tOB, o.oZe.jbe /* renamed from: a */ public final oZe.IeS c(int i) { if (i < this.b) { throw new IllegalArgumentException(); } return new WRU(Arrays.copyOf(this.c, i), this.b); } @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) { c(); int i = this.b; 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.b; this.b = i2 + 1; dArr3[i2] = d; } @Override // o.kOJ, java.util.AbstractCollection, java.util.Collection, java.util.List public final boolean addAll(Collection collection) { c(); oZe.c(collection); if (!(collection instanceof WRU)) { return super.addAll(collection); } WRU wru = (WRU) collection; int i = wru.b; if (i == 0) { return false; } int i2 = this.b; 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(wru.c, 0, this.c, this.b, wru.b); this.b = i3; ((AbstractList) this).modCount++; return true; } private void d(int i) { if (i < 0 || i >= this.b) { StringBuilder sb = new StringBuilder("Index:"); sb.append(i); sb.append(", Size:"); sb.append(this.b); throw new IndexOutOfBoundsException(sb.toString()); } } @Override // java.util.AbstractList, java.util.List public final /* synthetic */ Object get(int i) { d(i); return Double.valueOf(this.c[i]); } @Override // o.kOJ, java.util.AbstractList, java.util.List public final /* synthetic */ Object remove(int i) { c(); d(i); double[] dArr = this.c; double d = dArr[i]; if (i < this.b - 1) { System.arraycopy(dArr, i + 1, dArr, i, (r3 - i) - 1); } this.b--; ((AbstractList) this).modCount++; return Double.valueOf(d); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.List public final int size() { return this.b; } }