what-the-bank/sources/o/nBu.java

221 lines
6.3 KiB
Java

package o;
import java.util.AbstractList;
import java.util.Arrays;
import java.util.Collection;
import java.util.RandomAccess;
import o.oZe;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes2.dex */
public final class nBu extends kOJ<Integer> implements oZe.saX, RandomAccess, vjv {
int[] a;
private int b;
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
int intValue = ((Integer) obj).intValue();
c();
if (i >= 0 && i <= (i2 = this.b)) {
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.b - i);
this.a = iArr2;
}
this.a[i] = intValue;
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) {
d(((Integer) obj).intValue());
return true;
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
int intValue = ((Integer) obj).intValue();
c();
e(i);
int[] iArr = this.a;
int i2 = iArr[i];
iArr[i] = intValue;
return Integer.valueOf(i2);
}
static {
new nBu(new int[0], 0).d();
}
nBu() {
this(new int[10], 0);
}
private nBu(int[] iArr, int i) {
this.a = iArr;
this.b = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
c();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
int[] iArr = this.a;
System.arraycopy(iArr, i2, iArr, 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 nBu)) {
return super.equals(obj);
}
nBu nbu = (nBu) obj;
if (this.b != nbu.b) {
return false;
}
int[] iArr = nbu.a;
for (int i = 0; i < this.b; i++) {
if (this.a[i] != iArr[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) + this.a[i2];
}
return i;
}
@Override // o.oZe.tOB, o.oZe.jbe
/* renamed from: a */
public final oZe.saX c(int i) {
if (i < this.b) {
throw new IllegalArgumentException();
}
return new nBu(Arrays.copyOf(this.a, i), this.b);
}
@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 d(int i) {
c();
int i2 = this.b;
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.b;
this.b = i3 + 1;
iArr3[i3] = i;
}
@Override // o.kOJ, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Integer> collection) {
c();
oZe.c(collection);
if (!(collection instanceof nBu)) {
return super.addAll(collection);
}
nBu nbu = (nBu) collection;
int i = nbu.b;
if (i == 0) {
return false;
}
int i2 = this.b;
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(nbu.a, 0, this.a, this.b, nbu.b);
this.b = i3;
((AbstractList) this).modCount++;
return true;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void e(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) {
e(i);
return Integer.valueOf(this.a[i]);
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
c();
e(i);
int[] iArr = this.a;
int i2 = iArr[i];
if (i < this.b - 1) {
System.arraycopy(iArr, i + 1, iArr, i, (r2 - i) - 1);
}
this.b--;
((AbstractList) this).modCount++;
return Integer.valueOf(i2);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.b;
}
}