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

220 lines
6.2 KiB
Java

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 AVn extends kOJ<Long> implements oZe.jbe, RandomAccess, vjv {
long[] d;
private int e;
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
long longValue = ((Long) obj).longValue();
c();
if (i >= 0 && i <= (i2 = this.e)) {
long[] jArr = this.d;
if (i2 < jArr.length) {
System.arraycopy(jArr, i, jArr, i + 1, i2 - i);
} else {
long[] jArr2 = new long[((i2 * 3) / 2) + 1];
System.arraycopy(jArr, 0, jArr2, 0, i);
System.arraycopy(this.d, i, jArr2, i + 1, this.e - i);
this.d = jArr2;
}
this.d[i] = longValue;
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.kOJ, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
public final /* synthetic */ boolean add(Object obj) {
c(((Long) obj).longValue());
return true;
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
long longValue = ((Long) obj).longValue();
c();
b(i);
long[] jArr = this.d;
long j = jArr[i];
jArr[i] = longValue;
return Long.valueOf(j);
}
static {
new AVn(new long[0], 0).d();
}
AVn() {
this(new long[10], 0);
}
private AVn(long[] jArr, int i) {
this.d = jArr;
this.e = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
c();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
long[] jArr = this.d;
System.arraycopy(jArr, i2, jArr, i, this.e - i2);
this.e -= 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 AVn)) {
return super.equals(obj);
}
AVn aVn = (AVn) obj;
if (this.e != aVn.e) {
return false;
}
long[] jArr = aVn.d;
for (int i = 0; i < this.e; i++) {
if (this.d[i] != jArr[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.e; i2++) {
i = (i * 31) + oZe.e(this.d[i2]);
}
return i;
}
@Override // o.oZe.tOB, o.oZe.jbe
/* renamed from: a */
public final oZe.jbe c(int i) {
if (i < this.e) {
throw new IllegalArgumentException();
}
return new AVn(Arrays.copyOf(this.d, i), this.e);
}
@Override // java.util.AbstractList, java.util.List
public final int indexOf(Object obj) {
if (!(obj instanceof Long)) {
return -1;
}
long longValue = ((Long) obj).longValue();
int size = size();
for (int i = 0; i < size; i++) {
if (this.d[i] == longValue) {
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(long j) {
c();
int i = this.e;
long[] jArr = this.d;
if (i == jArr.length) {
long[] jArr2 = new long[((i * 3) / 2) + 1];
System.arraycopy(jArr, 0, jArr2, 0, i);
this.d = jArr2;
}
long[] jArr3 = this.d;
int i2 = this.e;
this.e = i2 + 1;
jArr3[i2] = j;
}
@Override // o.kOJ, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Long> collection) {
c();
oZe.c(collection);
if (!(collection instanceof AVn)) {
return super.addAll(collection);
}
AVn aVn = (AVn) collection;
int i = aVn.e;
if (i == 0) {
return false;
}
int i2 = this.e;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
long[] jArr = this.d;
if (i3 > jArr.length) {
this.d = Arrays.copyOf(jArr, i3);
}
System.arraycopy(aVn.d, 0, this.d, this.e, aVn.e);
this.e = i3;
((AbstractList) this).modCount++;
return true;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void b(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) {
b(i);
return Long.valueOf(this.d[i]);
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
c();
b(i);
long[] jArr = this.d;
long j = jArr[i];
if (i < this.e - 1) {
System.arraycopy(jArr, i + 1, jArr, i, (r3 - i) - 1);
}
this.e--;
((AbstractList) this).modCount++;
return Long.valueOf(j);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.e;
}
}