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

219 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;
/* loaded from: classes2.dex */
final class XBu extends kOJ<Boolean> implements oZe.HBt, RandomAccess, vjv {
private boolean[] d;
private int e;
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
boolean booleanValue = ((Boolean) obj).booleanValue();
c();
if (i >= 0 && i <= (i2 = this.e)) {
boolean[] zArr = this.d;
if (i2 < zArr.length) {
System.arraycopy(zArr, i, zArr, i + 1, i2 - i);
} else {
boolean[] zArr2 = new boolean[((i2 * 3) / 2) + 1];
System.arraycopy(zArr, 0, zArr2, 0, i);
System.arraycopy(this.d, i, zArr2, i + 1, this.e - i);
this.d = zArr2;
}
this.d[i] = booleanValue;
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) {
b(((Boolean) obj).booleanValue());
return true;
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
boolean booleanValue = ((Boolean) obj).booleanValue();
c();
d(i);
boolean[] zArr = this.d;
boolean z = zArr[i];
zArr[i] = booleanValue;
return Boolean.valueOf(z);
}
static {
new XBu(new boolean[0], 0).d();
}
XBu() {
this(new boolean[10], 0);
}
private XBu(boolean[] zArr, int i) {
this.d = zArr;
this.e = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
c();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
boolean[] zArr = this.d;
System.arraycopy(zArr, i2, zArr, 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 XBu)) {
return super.equals(obj);
}
XBu xBu = (XBu) obj;
if (this.e != xBu.e) {
return false;
}
boolean[] zArr = xBu.d;
for (int i = 0; i < this.e; i++) {
if (this.d[i] != zArr[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: b */
public final oZe.HBt c(int i) {
if (i < this.e) {
throw new IllegalArgumentException();
}
return new XBu(Arrays.copyOf(this.d, i), this.e);
}
@Override // java.util.AbstractList, java.util.List
public final int indexOf(Object obj) {
if (!(obj instanceof Boolean)) {
return -1;
}
boolean booleanValue = ((Boolean) obj).booleanValue();
int size = size();
for (int i = 0; i < size; i++) {
if (this.d[i] == booleanValue) {
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 b(boolean z) {
c();
int i = this.e;
boolean[] zArr = this.d;
if (i == zArr.length) {
boolean[] zArr2 = new boolean[((i * 3) / 2) + 1];
System.arraycopy(zArr, 0, zArr2, 0, i);
this.d = zArr2;
}
boolean[] zArr3 = this.d;
int i2 = this.e;
this.e = i2 + 1;
zArr3[i2] = z;
}
@Override // o.kOJ, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Boolean> collection) {
c();
oZe.c(collection);
if (!(collection instanceof XBu)) {
return super.addAll(collection);
}
XBu xBu = (XBu) collection;
int i = xBu.e;
if (i == 0) {
return false;
}
int i2 = this.e;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
boolean[] zArr = this.d;
if (i3 > zArr.length) {
this.d = Arrays.copyOf(zArr, i3);
}
System.arraycopy(xBu.d, 0, this.d, this.e, xBu.e);
this.e = i3;
((AbstractList) this).modCount++;
return true;
}
private void d(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) {
d(i);
return Boolean.valueOf(this.d[i]);
}
@Override // o.kOJ, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
c();
d(i);
boolean[] zArr = this.d;
boolean z = zArr[i];
if (i < this.e - 1) {
System.arraycopy(zArr, i + 1, zArr, i, (r2 - i) - 1);
}
this.e--;
((AbstractList) this).modCount++;
return Boolean.valueOf(z);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.e;
}
}