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

218 lines
6.4 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
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 Twb extends AbstractC15969jyR<Boolean> implements pqw, RandomAccess, VAu {
private boolean[] a;
private int c;
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ void add(int i, Object obj) {
int i2;
boolean booleanValue = ((Boolean) obj).booleanValue();
d();
if (i >= 0 && i <= (i2 = this.c)) {
boolean[] zArr = this.a;
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.a, i, zArr2, i + 1, this.c - i);
this.a = zArr2;
}
this.a[i] = booleanValue;
this.c++;
((AbstractList) this).modCount++;
return;
}
StringBuilder sb = new StringBuilder("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(this.c);
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) {
b(((Boolean) obj).booleanValue());
return true;
}
@Override // o.MTP.RVV
public final /* synthetic */ MTP.RVV b(int i) {
if (i < this.c) {
throw new IllegalArgumentException();
}
return new Twb(Arrays.copyOf(this.a, i), this.c);
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ Object set(int i, Object obj) {
boolean booleanValue = ((Boolean) obj).booleanValue();
d();
c(i);
boolean[] zArr = this.a;
boolean z = zArr[i];
zArr[i] = booleanValue;
return Boolean.valueOf(z);
}
static {
new Twb(new boolean[0], 0).a();
}
Twb() {
this(new boolean[10], 0);
}
private Twb(boolean[] zArr, int i) {
this.a = zArr;
this.c = i;
}
@Override // java.util.AbstractList
protected final void removeRange(int i, int i2) {
d();
if (i2 < i) {
throw new IndexOutOfBoundsException("toIndex < fromIndex");
}
boolean[] zArr = this.a;
System.arraycopy(zArr, i2, zArr, i, this.c - i2);
this.c -= 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 Twb)) {
return super.equals(obj);
}
Twb twb = (Twb) obj;
if (this.c != twb.c) {
return false;
}
boolean[] zArr = twb.a;
for (int i = 0; i < this.c; i++) {
if (this.a[i] != zArr[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.c; i2++) {
i = (i * 31) + MTP.c(this.a[i2]);
}
return i;
}
@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.a[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) {
d();
int i = this.c;
boolean[] zArr = this.a;
if (i == zArr.length) {
boolean[] zArr2 = new boolean[((i * 3) / 2) + 1];
System.arraycopy(zArr, 0, zArr2, 0, i);
this.a = zArr2;
}
boolean[] zArr3 = this.a;
int i2 = this.c;
this.c = i2 + 1;
zArr3[i2] = z;
}
@Override // o.AbstractC15969jyR, java.util.AbstractCollection, java.util.Collection, java.util.List
public final boolean addAll(Collection<? extends Boolean> collection) {
d();
MTP.d(collection);
if (!(collection instanceof Twb)) {
return super.addAll(collection);
}
Twb twb = (Twb) collection;
int i = twb.c;
if (i == 0) {
return false;
}
int i2 = this.c;
if (Integer.MAX_VALUE - i2 < i) {
throw new OutOfMemoryError();
}
int i3 = i2 + i;
boolean[] zArr = this.a;
if (i3 > zArr.length) {
this.a = Arrays.copyOf(zArr, i3);
}
System.arraycopy(twb.a, 0, this.a, this.c, twb.c);
this.c = i3;
((AbstractList) this).modCount++;
return true;
}
private void c(int i) {
if (i < 0 || i >= this.c) {
StringBuilder sb = new StringBuilder("Index:");
sb.append(i);
sb.append(", Size:");
sb.append(this.c);
throw new IndexOutOfBoundsException(sb.toString());
}
}
@Override // java.util.AbstractList, java.util.List
public final /* synthetic */ Object get(int i) {
c(i);
return Boolean.valueOf(this.a[i]);
}
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
public final /* synthetic */ Object remove(int i) {
d();
c(i);
boolean[] zArr = this.a;
boolean z = zArr[i];
if (i < this.c - 1) {
System.arraycopy(zArr, i + 1, zArr, i, (r2 - i) - 1);
}
this.c--;
((AbstractList) this).modCount++;
return Boolean.valueOf(z);
}
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
public final int size() {
return this.c;
}
}