You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
510 lines
14 KiB
510 lines
14 KiB
package p037m;
|
|
|
|
import java.lang.reflect.Array;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.Map;
|
|
import java.util.Set;
|
|
|
|
/* renamed from: m.b */
|
|
/* loaded from: classes.dex */
|
|
public final class C1446b<E> implements Collection<E>, Set<E> {
|
|
|
|
/* renamed from: h */
|
|
public static final int[] f3151h = new int[0];
|
|
|
|
/* renamed from: i */
|
|
public static final Object[] f3152i = new Object[0];
|
|
|
|
/* renamed from: j */
|
|
public static Object[] f3153j;
|
|
|
|
/* renamed from: k */
|
|
public static int f3154k;
|
|
|
|
/* renamed from: l */
|
|
public static Object[] f3155l;
|
|
|
|
/* renamed from: m */
|
|
public static int f3156m;
|
|
|
|
/* renamed from: d */
|
|
public int[] f3157d;
|
|
|
|
/* renamed from: e */
|
|
public Object[] f3158e;
|
|
|
|
/* renamed from: f */
|
|
public int f3159f;
|
|
|
|
/* renamed from: g */
|
|
public AbstractC1451f<E, E> f3160g;
|
|
|
|
/* renamed from: m.b$a */
|
|
/* loaded from: classes.dex */
|
|
public class C1447a extends AbstractC1451f<E, E> {
|
|
public C1447a() {
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: a */
|
|
public void mo1350a() {
|
|
C1446b.this.clear();
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: b */
|
|
public Object mo1349b(int i, int i2) {
|
|
return C1446b.this.f3158e[i];
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: c */
|
|
public Map<E, E> mo1348c() {
|
|
throw new UnsupportedOperationException("not a map");
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: d */
|
|
public int mo1347d() {
|
|
return C1446b.this.f3159f;
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: e */
|
|
public int mo1346e(Object obj) {
|
|
return C1446b.this.indexOf(obj);
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: f */
|
|
public int mo1345f(Object obj) {
|
|
return C1446b.this.indexOf(obj);
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: g */
|
|
public void mo1344g(E e, E e2) {
|
|
C1446b.this.add(e);
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: h */
|
|
public void mo1343h(int i) {
|
|
C1446b.this.m1376g(i);
|
|
}
|
|
|
|
@Override // p037m.AbstractC1451f
|
|
/* renamed from: i */
|
|
public E mo1342i(int i, E e) {
|
|
throw new UnsupportedOperationException("not a map");
|
|
}
|
|
}
|
|
|
|
public C1446b() {
|
|
this(0);
|
|
}
|
|
|
|
public C1446b(int i) {
|
|
if (i == 0) {
|
|
this.f3157d = f3151h;
|
|
this.f3158e = f3152i;
|
|
} else {
|
|
m1382a(i);
|
|
}
|
|
this.f3159f = 0;
|
|
}
|
|
|
|
/* renamed from: c */
|
|
public static void m1380c(int[] iArr, Object[] objArr, int i) {
|
|
if (iArr.length == 8) {
|
|
synchronized (C1446b.class) {
|
|
if (f3156m < 10) {
|
|
objArr[0] = f3155l;
|
|
objArr[1] = iArr;
|
|
for (int i2 = i - 1; i2 >= 2; i2--) {
|
|
objArr[i2] = null;
|
|
}
|
|
f3155l = objArr;
|
|
f3156m++;
|
|
}
|
|
}
|
|
} else if (iArr.length == 4) {
|
|
synchronized (C1446b.class) {
|
|
if (f3154k < 10) {
|
|
objArr[0] = f3153j;
|
|
objArr[1] = iArr;
|
|
for (int i3 = i - 1; i3 >= 2; i3--) {
|
|
objArr[i3] = null;
|
|
}
|
|
f3153j = objArr;
|
|
f3154k++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/* renamed from: a */
|
|
public final void m1382a(int i) {
|
|
if (i == 8) {
|
|
synchronized (C1446b.class) {
|
|
Object[] objArr = f3155l;
|
|
if (objArr != null) {
|
|
this.f3158e = objArr;
|
|
f3155l = (Object[]) objArr[0];
|
|
this.f3157d = (int[]) objArr[1];
|
|
objArr[1] = null;
|
|
objArr[0] = null;
|
|
f3156m--;
|
|
return;
|
|
}
|
|
}
|
|
} else if (i == 4) {
|
|
synchronized (C1446b.class) {
|
|
Object[] objArr2 = f3153j;
|
|
if (objArr2 != null) {
|
|
this.f3158e = objArr2;
|
|
f3153j = (Object[]) objArr2[0];
|
|
this.f3157d = (int[]) objArr2[1];
|
|
objArr2[1] = null;
|
|
objArr2[0] = null;
|
|
f3154k--;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this.f3157d = new int[i];
|
|
this.f3158e = new Object[i];
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean add(E e) {
|
|
int i;
|
|
int m1378e;
|
|
if (e == null) {
|
|
m1378e = m1377f();
|
|
i = 0;
|
|
} else {
|
|
int hashCode = e.hashCode();
|
|
i = hashCode;
|
|
m1378e = m1378e(e, hashCode);
|
|
}
|
|
if (m1378e >= 0) {
|
|
return false;
|
|
}
|
|
int i2 = m1378e ^ (-1);
|
|
int i3 = this.f3159f;
|
|
int[] iArr = this.f3157d;
|
|
if (i3 >= iArr.length) {
|
|
int i4 = 8;
|
|
if (i3 >= 8) {
|
|
i4 = (i3 >> 1) + i3;
|
|
} else if (i3 < 4) {
|
|
i4 = 4;
|
|
}
|
|
Object[] objArr = this.f3158e;
|
|
m1382a(i4);
|
|
int[] iArr2 = this.f3157d;
|
|
if (iArr2.length > 0) {
|
|
System.arraycopy(iArr, 0, iArr2, 0, iArr.length);
|
|
System.arraycopy(objArr, 0, this.f3158e, 0, objArr.length);
|
|
}
|
|
m1380c(iArr, objArr, this.f3159f);
|
|
}
|
|
int i5 = this.f3159f;
|
|
if (i2 < i5) {
|
|
int[] iArr3 = this.f3157d;
|
|
int i6 = i2 + 1;
|
|
System.arraycopy(iArr3, i2, iArr3, i6, i5 - i2);
|
|
Object[] objArr2 = this.f3158e;
|
|
System.arraycopy(objArr2, i2, objArr2, i6, this.f3159f - i2);
|
|
}
|
|
this.f3157d[i2] = i;
|
|
this.f3158e[i2] = e;
|
|
this.f3159f++;
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean addAll(Collection<? extends E> collection) {
|
|
m1381b(this.f3159f + collection.size());
|
|
boolean z = false;
|
|
for (E e : collection) {
|
|
z |= add(e);
|
|
}
|
|
return z;
|
|
}
|
|
|
|
/* renamed from: b */
|
|
public void m1381b(int i) {
|
|
int[] iArr = this.f3157d;
|
|
if (iArr.length < i) {
|
|
Object[] objArr = this.f3158e;
|
|
m1382a(i);
|
|
int i2 = this.f3159f;
|
|
if (i2 > 0) {
|
|
System.arraycopy(iArr, 0, this.f3157d, 0, i2);
|
|
System.arraycopy(objArr, 0, this.f3158e, 0, this.f3159f);
|
|
}
|
|
m1380c(iArr, objArr, this.f3159f);
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public void clear() {
|
|
int i = this.f3159f;
|
|
if (i != 0) {
|
|
m1380c(this.f3157d, this.f3158e, i);
|
|
this.f3157d = f3151h;
|
|
this.f3158e = f3152i;
|
|
this.f3159f = 0;
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
return indexOf(obj) >= 0;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean containsAll(Collection<?> collection) {
|
|
Iterator<?> it = collection.iterator();
|
|
while (it.hasNext()) {
|
|
if (!contains(it.next())) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/* renamed from: d */
|
|
public final AbstractC1451f<E, E> m1379d() {
|
|
if (this.f3160g == null) {
|
|
this.f3160g = new C1447a();
|
|
}
|
|
return this.f3160g;
|
|
}
|
|
|
|
/* renamed from: e */
|
|
public final int m1378e(Object obj, int i) {
|
|
int i2 = this.f3159f;
|
|
if (i2 == 0) {
|
|
return -1;
|
|
}
|
|
int m1374a = C1448c.m1374a(this.f3157d, i2, i);
|
|
if (m1374a >= 0 && !obj.equals(this.f3158e[m1374a])) {
|
|
int i3 = m1374a + 1;
|
|
while (i3 < i2 && this.f3157d[i3] == i) {
|
|
if (obj.equals(this.f3158e[i3])) {
|
|
return i3;
|
|
}
|
|
i3++;
|
|
}
|
|
for (int i4 = m1374a - 1; i4 >= 0 && this.f3157d[i4] == i; i4--) {
|
|
if (obj.equals(this.f3158e[i4])) {
|
|
return i4;
|
|
}
|
|
}
|
|
return i3 ^ (-1);
|
|
}
|
|
return m1374a;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj instanceof Set) {
|
|
Set set = (Set) obj;
|
|
if (size() != set.size()) {
|
|
return false;
|
|
}
|
|
for (int i = 0; i < this.f3159f; i++) {
|
|
try {
|
|
if (!set.contains(m1375h(i))) {
|
|
return false;
|
|
}
|
|
} catch (ClassCastException | NullPointerException unused) {
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
/* renamed from: f */
|
|
public final int m1377f() {
|
|
int i = this.f3159f;
|
|
if (i == 0) {
|
|
return -1;
|
|
}
|
|
int m1374a = C1448c.m1374a(this.f3157d, i, 0);
|
|
if (m1374a >= 0 && this.f3158e[m1374a] != null) {
|
|
int i2 = m1374a + 1;
|
|
while (i2 < i && this.f3157d[i2] == 0) {
|
|
if (this.f3158e[i2] == null) {
|
|
return i2;
|
|
}
|
|
i2++;
|
|
}
|
|
for (int i3 = m1374a - 1; i3 >= 0 && this.f3157d[i3] == 0; i3--) {
|
|
if (this.f3158e[i3] == null) {
|
|
return i3;
|
|
}
|
|
}
|
|
return i2 ^ (-1);
|
|
}
|
|
return m1374a;
|
|
}
|
|
|
|
/* renamed from: g */
|
|
public E m1376g(int i) {
|
|
Object[] objArr = this.f3158e;
|
|
E e = (E) objArr[i];
|
|
int i2 = this.f3159f;
|
|
if (i2 <= 1) {
|
|
m1380c(this.f3157d, objArr, i2);
|
|
this.f3157d = f3151h;
|
|
this.f3158e = f3152i;
|
|
this.f3159f = 0;
|
|
} else {
|
|
int[] iArr = this.f3157d;
|
|
if (iArr.length <= 8 || i2 >= iArr.length / 3) {
|
|
int i3 = i2 - 1;
|
|
this.f3159f = i3;
|
|
if (i < i3) {
|
|
int i4 = i + 1;
|
|
System.arraycopy(iArr, i4, iArr, i, i3 - i);
|
|
Object[] objArr2 = this.f3158e;
|
|
System.arraycopy(objArr2, i4, objArr2, i, this.f3159f - i);
|
|
}
|
|
this.f3158e[this.f3159f] = null;
|
|
} else {
|
|
m1382a(i2 > 8 ? i2 + (i2 >> 1) : 8);
|
|
this.f3159f--;
|
|
if (i > 0) {
|
|
System.arraycopy(iArr, 0, this.f3157d, 0, i);
|
|
System.arraycopy(objArr, 0, this.f3158e, 0, i);
|
|
}
|
|
int i5 = this.f3159f;
|
|
if (i < i5) {
|
|
int i6 = i + 1;
|
|
System.arraycopy(iArr, i6, this.f3157d, i, i5 - i);
|
|
System.arraycopy(objArr, i6, this.f3158e, i, this.f3159f - i);
|
|
}
|
|
}
|
|
}
|
|
return e;
|
|
}
|
|
|
|
/* renamed from: h */
|
|
public E m1375h(int i) {
|
|
return (E) this.f3158e[i];
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public int hashCode() {
|
|
int[] iArr = this.f3157d;
|
|
int i = this.f3159f;
|
|
int i2 = 0;
|
|
for (int i3 = 0; i3 < i; i3++) {
|
|
i2 += iArr[i3];
|
|
}
|
|
return i2;
|
|
}
|
|
|
|
public int indexOf(Object obj) {
|
|
return obj == null ? m1377f() : m1378e(obj, obj.hashCode());
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean isEmpty() {
|
|
return this.f3159f <= 0;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.lang.Iterable, java.util.Set
|
|
public Iterator<E> iterator() {
|
|
return m1379d().m1338m().iterator();
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean remove(Object obj) {
|
|
int indexOf = indexOf(obj);
|
|
if (indexOf >= 0) {
|
|
m1376g(indexOf);
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean removeAll(Collection<?> collection) {
|
|
Iterator<?> it = collection.iterator();
|
|
boolean z = false;
|
|
while (it.hasNext()) {
|
|
z |= remove(it.next());
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public boolean retainAll(Collection<?> collection) {
|
|
boolean z = false;
|
|
for (int i = this.f3159f - 1; i >= 0; i--) {
|
|
if (!collection.contains(this.f3158e[i])) {
|
|
m1376g(i);
|
|
z = true;
|
|
}
|
|
}
|
|
return z;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return this.f3159f;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public Object[] toArray() {
|
|
int i = this.f3159f;
|
|
Object[] objArr = new Object[i];
|
|
System.arraycopy(this.f3158e, 0, objArr, 0, i);
|
|
return objArr;
|
|
}
|
|
|
|
@Override // java.util.Collection, java.util.Set
|
|
public <T> T[] toArray(T[] tArr) {
|
|
if (tArr.length < this.f3159f) {
|
|
tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), this.f3159f));
|
|
}
|
|
System.arraycopy(this.f3158e, 0, tArr, 0, this.f3159f);
|
|
int length = tArr.length;
|
|
int i = this.f3159f;
|
|
if (length > i) {
|
|
tArr[i] = null;
|
|
}
|
|
return tArr;
|
|
}
|
|
|
|
public String toString() {
|
|
if (isEmpty()) {
|
|
return "{}";
|
|
}
|
|
StringBuilder sb = new StringBuilder(this.f3159f * 14);
|
|
sb.append('{');
|
|
for (int i = 0; i < this.f3159f; i++) {
|
|
if (i > 0) {
|
|
sb.append(", ");
|
|
}
|
|
E m1375h = m1375h(i);
|
|
if (m1375h != this) {
|
|
sb.append(m1375h);
|
|
} else {
|
|
sb.append("(this Set)");
|
|
}
|
|
}
|
|
sb.append('}');
|
|
return sb.toString();
|
|
}
|
|
} |