130 lines
3.5 KiB
Java
130 lines
3.5 KiB
Java
|
package o;
|
||
|
|
||
|
import java.util.AbstractList;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.RandomAccess;
|
||
|
import o.MTP;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes2.dex */
|
||
|
public final class ulH<E> extends AbstractC15969jyR<E> implements RandomAccess {
|
||
|
private static final ulH<Object> b;
|
||
|
private E[] a;
|
||
|
private int e;
|
||
|
|
||
|
@Override // o.MTP.RVV
|
||
|
public final /* synthetic */ MTP.RVV b(int i) {
|
||
|
if (i < this.e) {
|
||
|
throw new IllegalArgumentException();
|
||
|
}
|
||
|
return new ulH(Arrays.copyOf(this.a, i), this.e);
|
||
|
}
|
||
|
|
||
|
static {
|
||
|
ulH<Object> ulh = new ulH<>(new Object[0], 0);
|
||
|
b = ulh;
|
||
|
ulh.a();
|
||
|
}
|
||
|
|
||
|
ulH() {
|
||
|
this(new Object[10], 0);
|
||
|
}
|
||
|
|
||
|
private ulH(E[] eArr, int i) {
|
||
|
this.a = eArr;
|
||
|
this.e = i;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public final boolean add(E e) {
|
||
|
d();
|
||
|
int i = this.e;
|
||
|
E[] eArr = this.a;
|
||
|
if (i == eArr.length) {
|
||
|
this.a = (E[]) Arrays.copyOf(eArr, ((i * 3) / 2) + 1);
|
||
|
}
|
||
|
E[] eArr2 = this.a;
|
||
|
int i2 = this.e;
|
||
|
this.e = i2 + 1;
|
||
|
eArr2[i2] = e;
|
||
|
((AbstractList) this).modCount++;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
|
||
|
public final void add(int i, E e) {
|
||
|
int i2;
|
||
|
d();
|
||
|
if (i >= 0 && i <= (i2 = this.e)) {
|
||
|
E[] eArr = this.a;
|
||
|
if (i2 < eArr.length) {
|
||
|
System.arraycopy(eArr, i, eArr, i + 1, i2 - i);
|
||
|
} else {
|
||
|
E[] eArr2 = (E[]) new Object[((i2 * 3) / 2) + 1];
|
||
|
System.arraycopy(eArr, 0, eArr2, 0, i);
|
||
|
System.arraycopy(this.a, i, eArr2, i + 1, this.e - i);
|
||
|
this.a = eArr2;
|
||
|
}
|
||
|
this.a[i] = e;
|
||
|
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 // java.util.AbstractList, java.util.List
|
||
|
public final E get(int i) {
|
||
|
e(i);
|
||
|
return this.a[i];
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
|
||
|
public final E remove(int i) {
|
||
|
d();
|
||
|
e(i);
|
||
|
E[] eArr = this.a;
|
||
|
E e = eArr[i];
|
||
|
if (i < this.e - 1) {
|
||
|
System.arraycopy(eArr, i + 1, eArr, i, (r2 - i) - 1);
|
||
|
}
|
||
|
this.e--;
|
||
|
((AbstractList) this).modCount++;
|
||
|
return e;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15969jyR, java.util.AbstractList, java.util.List
|
||
|
public final E set(int i, E e) {
|
||
|
d();
|
||
|
e(i);
|
||
|
E[] eArr = this.a;
|
||
|
E e2 = eArr[i];
|
||
|
eArr[i] = e;
|
||
|
((AbstractList) this).modCount++;
|
||
|
return e2;
|
||
|
}
|
||
|
|
||
|
private void e(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.AbstractCollection, java.util.Collection, java.util.List
|
||
|
public final int size() {
|
||
|
return this.e;
|
||
|
}
|
||
|
|
||
|
public static <E> ulH<E> b() {
|
||
|
return (ulH<E>) b;
|
||
|
}
|
||
|
}
|