525 lines
14 KiB
Java
525 lines
14 KiB
Java
package o;
|
|
|
|
import com.airbnb.deeplinkdispatch.UrlTreeKt;
|
|
import java.util.ConcurrentModificationException;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class DFj<K, V> {
|
|
private static Object[] a;
|
|
private static Object[] c;
|
|
private static int d;
|
|
private static int g;
|
|
int b;
|
|
public Object[] e;
|
|
private int[] j;
|
|
|
|
private static int c(int[] iArr, int i, int i2) {
|
|
try {
|
|
return C6569cWs.e(iArr, i, i2);
|
|
} catch (ArrayIndexOutOfBoundsException unused) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
}
|
|
|
|
public final int c(Object obj, int i) {
|
|
int i2 = this.b;
|
|
if (i2 == 0) {
|
|
return -1;
|
|
}
|
|
int c2 = c(this.j, i2, i);
|
|
if (c2 < 0 || obj.equals(this.e[c2 << 1])) {
|
|
return c2;
|
|
}
|
|
int i3 = c2 + 1;
|
|
while (i3 < i2 && this.j[i3] == i) {
|
|
if (obj.equals(this.e[i3 << 1])) {
|
|
return i3;
|
|
}
|
|
i3++;
|
|
}
|
|
for (int i4 = c2 - 1; i4 >= 0 && this.j[i4] == i; i4--) {
|
|
if (obj.equals(this.e[i4 << 1])) {
|
|
return i4;
|
|
}
|
|
}
|
|
return ~i3;
|
|
}
|
|
|
|
public final int d() {
|
|
int i = this.b;
|
|
if (i == 0) {
|
|
return -1;
|
|
}
|
|
int c2 = c(this.j, i, 0);
|
|
if (c2 < 0 || this.e[c2 << 1] == null) {
|
|
return c2;
|
|
}
|
|
int i2 = c2 + 1;
|
|
while (i2 < i && this.j[i2] == 0) {
|
|
if (this.e[i2 << 1] == null) {
|
|
return i2;
|
|
}
|
|
i2++;
|
|
}
|
|
for (int i3 = c2 - 1; i3 >= 0 && this.j[i3] == 0; i3--) {
|
|
if (this.e[i3 << 1] == null) {
|
|
return i3;
|
|
}
|
|
}
|
|
return ~i2;
|
|
}
|
|
|
|
private void b(int i) {
|
|
if (i == 8) {
|
|
synchronized (DFj.class) {
|
|
Object[] objArr = c;
|
|
if (objArr != null) {
|
|
this.e = objArr;
|
|
c = (Object[]) objArr[0];
|
|
this.j = (int[]) objArr[1];
|
|
objArr[1] = null;
|
|
objArr[0] = null;
|
|
g--;
|
|
return;
|
|
}
|
|
}
|
|
} else if (i == 4) {
|
|
synchronized (DFj.class) {
|
|
Object[] objArr2 = a;
|
|
if (objArr2 != null) {
|
|
this.e = objArr2;
|
|
a = (Object[]) objArr2[0];
|
|
this.j = (int[]) objArr2[1];
|
|
objArr2[1] = null;
|
|
objArr2[0] = null;
|
|
d--;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
this.j = new int[i];
|
|
this.e = new Object[i << 1];
|
|
}
|
|
|
|
private static void d(int[] iArr, Object[] objArr, int i) {
|
|
if (iArr.length == 8) {
|
|
synchronized (DFj.class) {
|
|
if (g < 10) {
|
|
objArr[0] = c;
|
|
objArr[1] = iArr;
|
|
for (int i2 = (i << 1) - 1; i2 >= 2; i2--) {
|
|
objArr[i2] = null;
|
|
}
|
|
c = objArr;
|
|
g++;
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
if (iArr.length == 4) {
|
|
synchronized (DFj.class) {
|
|
if (d < 10) {
|
|
objArr[0] = a;
|
|
objArr[1] = iArr;
|
|
for (int i3 = (i << 1) - 1; i3 >= 2; i3--) {
|
|
objArr[i3] = null;
|
|
}
|
|
a = objArr;
|
|
d++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public DFj() {
|
|
this.j = C6569cWs.b;
|
|
this.e = C6569cWs.d;
|
|
this.b = 0;
|
|
}
|
|
|
|
public DFj(int i) {
|
|
if (i == 0) {
|
|
this.j = C6569cWs.b;
|
|
this.e = C6569cWs.d;
|
|
} else {
|
|
b(i);
|
|
}
|
|
this.b = 0;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public DFj(DFj<K, V> dFj) {
|
|
this();
|
|
if (dFj != 0) {
|
|
a(dFj);
|
|
}
|
|
}
|
|
|
|
public void clear() {
|
|
int i = this.b;
|
|
if (i > 0) {
|
|
int[] iArr = this.j;
|
|
Object[] objArr = this.e;
|
|
this.j = C6569cWs.b;
|
|
this.e = C6569cWs.d;
|
|
this.b = 0;
|
|
d(iArr, objArr, i);
|
|
}
|
|
if (this.b > 0) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
}
|
|
|
|
public final void d(int i) {
|
|
int i2 = this.b;
|
|
int[] iArr = this.j;
|
|
if (iArr.length < i) {
|
|
Object[] objArr = this.e;
|
|
b(i);
|
|
if (this.b > 0) {
|
|
System.arraycopy(iArr, 0, this.j, 0, i2);
|
|
System.arraycopy(objArr, 0, this.e, 0, i2 << 1);
|
|
}
|
|
d(iArr, objArr, i2);
|
|
}
|
|
if (this.b != i2) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
public final int c(Object obj) {
|
|
int i = this.b << 1;
|
|
Object[] objArr = this.e;
|
|
if (obj == null) {
|
|
for (int i2 = 1; i2 < i; i2 += 2) {
|
|
if (objArr[i2] == null) {
|
|
return i2 >> 1;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
for (int i3 = 1; i3 < i; i3 += 2) {
|
|
if (obj.equals(objArr[i3])) {
|
|
return i3 >> 1;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public boolean containsValue(Object obj) {
|
|
return c(obj) >= 0;
|
|
}
|
|
|
|
public V get(Object obj) {
|
|
return getOrDefault(obj, null);
|
|
}
|
|
|
|
public V d(int i, V v) {
|
|
int i2 = (i << 1) + 1;
|
|
Object[] objArr = this.e;
|
|
V v2 = (V) objArr[i2];
|
|
objArr[i2] = v;
|
|
return v2;
|
|
}
|
|
|
|
public V put(K k, V v) {
|
|
int i;
|
|
int c2;
|
|
int i2 = this.b;
|
|
if (k == null) {
|
|
c2 = d();
|
|
i = 0;
|
|
} else {
|
|
int hashCode = k.hashCode();
|
|
i = hashCode;
|
|
c2 = c(k, hashCode);
|
|
}
|
|
if (c2 >= 0) {
|
|
int i3 = (c2 << 1) + 1;
|
|
Object[] objArr = this.e;
|
|
V v2 = (V) objArr[i3];
|
|
objArr[i3] = v;
|
|
return v2;
|
|
}
|
|
int i4 = ~c2;
|
|
int[] iArr = this.j;
|
|
if (i2 >= iArr.length) {
|
|
int i5 = 8;
|
|
if (i2 >= 8) {
|
|
i5 = (i2 >> 1) + i2;
|
|
} else if (i2 < 4) {
|
|
i5 = 4;
|
|
}
|
|
Object[] objArr2 = this.e;
|
|
b(i5);
|
|
if (i2 != this.b) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
int[] iArr2 = this.j;
|
|
if (iArr2.length > 0) {
|
|
System.arraycopy(iArr, 0, iArr2, 0, iArr.length);
|
|
System.arraycopy(objArr2, 0, this.e, 0, objArr2.length);
|
|
}
|
|
d(iArr, objArr2, i2);
|
|
}
|
|
if (i4 < i2) {
|
|
int[] iArr3 = this.j;
|
|
int i6 = i4 + 1;
|
|
System.arraycopy(iArr3, i4, iArr3, i6, i2 - i4);
|
|
Object[] objArr3 = this.e;
|
|
System.arraycopy(objArr3, i4 << 1, objArr3, i6 << 1, (this.b - i4) << 1);
|
|
}
|
|
int i7 = this.b;
|
|
if (i2 == i7) {
|
|
int[] iArr4 = this.j;
|
|
if (i4 < iArr4.length) {
|
|
iArr4[i4] = i;
|
|
Object[] objArr4 = this.e;
|
|
int i8 = i4 << 1;
|
|
objArr4[i8] = k;
|
|
objArr4[i8 + 1] = v;
|
|
this.b = i7 + 1;
|
|
return null;
|
|
}
|
|
}
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
public void a(DFj<? extends K, ? extends V> dFj) {
|
|
int i = dFj.b;
|
|
d(this.b + i);
|
|
if (this.b == 0) {
|
|
if (i > 0) {
|
|
System.arraycopy(dFj.j, 0, this.j, 0, i);
|
|
System.arraycopy(dFj.e, 0, this.e, 0, i << 1);
|
|
this.b = i;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
Object[] objArr = dFj.e;
|
|
int i3 = i2 << 1;
|
|
put(objArr[i3], objArr[i3 + 1]);
|
|
}
|
|
}
|
|
|
|
public V putIfAbsent(K k, V v) {
|
|
V v2 = get(k);
|
|
return v2 == null ? put(k, v) : v2;
|
|
}
|
|
|
|
public V c(int i) {
|
|
Object[] objArr = this.e;
|
|
int i2 = i << 1;
|
|
V v = (V) objArr[i2 + 1];
|
|
int i3 = this.b;
|
|
int i4 = 0;
|
|
if (i3 <= 1) {
|
|
d(this.j, objArr, i3);
|
|
this.j = C6569cWs.b;
|
|
this.e = C6569cWs.d;
|
|
} else {
|
|
int i5 = i3 - 1;
|
|
int[] iArr = this.j;
|
|
if (iArr.length > 8 && i3 < iArr.length / 3) {
|
|
b(i3 > 8 ? i3 + (i3 >> 1) : 8);
|
|
if (i3 != this.b) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
if (i > 0) {
|
|
System.arraycopy(iArr, 0, this.j, 0, i);
|
|
System.arraycopy(objArr, 0, this.e, 0, i2);
|
|
}
|
|
if (i < i5) {
|
|
int i6 = i + 1;
|
|
int i7 = i5 - i;
|
|
System.arraycopy(iArr, i6, this.j, i, i7);
|
|
System.arraycopy(objArr, i6 << 1, this.e, i2, i7 << 1);
|
|
}
|
|
} else {
|
|
if (i < i5) {
|
|
int i8 = i + 1;
|
|
int i9 = i5 - i;
|
|
System.arraycopy(iArr, i8, iArr, i, i9);
|
|
Object[] objArr2 = this.e;
|
|
System.arraycopy(objArr2, i8 << 1, objArr2, i2, i9 << 1);
|
|
}
|
|
Object[] objArr3 = this.e;
|
|
int i10 = i5 << 1;
|
|
objArr3[i10] = null;
|
|
objArr3[i10 + 1] = null;
|
|
}
|
|
i4 = i5;
|
|
}
|
|
if (i3 != this.b) {
|
|
throw new ConcurrentModificationException();
|
|
}
|
|
this.b = i4;
|
|
return v;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (obj instanceof DFj) {
|
|
DFj dFj = (DFj) obj;
|
|
if (size() != dFj.size()) {
|
|
return false;
|
|
}
|
|
for (int i = 0; i < this.b; i++) {
|
|
try {
|
|
Object[] objArr = this.e;
|
|
int i2 = i << 1;
|
|
Object obj2 = objArr[i2];
|
|
Object obj3 = objArr[i2 + 1];
|
|
Object obj4 = dFj.get(obj2);
|
|
if (obj3 == null) {
|
|
if (obj4 != null || !dFj.containsKey(obj2)) {
|
|
return false;
|
|
}
|
|
} else if (!obj3.equals(obj4)) {
|
|
return false;
|
|
}
|
|
} catch (ClassCastException | NullPointerException unused) {
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
if (obj instanceof Map) {
|
|
Map map = (Map) obj;
|
|
if (size() != map.size()) {
|
|
return false;
|
|
}
|
|
for (int i3 = 0; i3 < this.b; i3++) {
|
|
try {
|
|
Object[] objArr2 = this.e;
|
|
int i4 = i3 << 1;
|
|
Object obj5 = objArr2[i4];
|
|
Object obj6 = objArr2[i4 + 1];
|
|
Object obj7 = map.get(obj5);
|
|
if (obj6 == null) {
|
|
if (obj7 != null || !map.containsKey(obj5)) {
|
|
return false;
|
|
}
|
|
} else if (!obj6.equals(obj7)) {
|
|
return false;
|
|
}
|
|
} catch (ClassCastException | NullPointerException unused2) {
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int[] iArr = this.j;
|
|
Object[] objArr = this.e;
|
|
int i = this.b;
|
|
int i2 = 1;
|
|
int i3 = 0;
|
|
int i4 = 0;
|
|
while (i3 < i) {
|
|
Object obj = objArr[i2];
|
|
i4 += (obj == null ? 0 : obj.hashCode()) ^ iArr[i3];
|
|
i3++;
|
|
i2 += 2;
|
|
}
|
|
return i4;
|
|
}
|
|
|
|
public String toString() {
|
|
if (isEmpty()) {
|
|
return "{}";
|
|
}
|
|
StringBuilder sb = new StringBuilder(this.b * 28);
|
|
sb.append(UrlTreeKt.componentParamPrefixChar);
|
|
for (int i = 0; i < this.b; i++) {
|
|
if (i > 0) {
|
|
sb.append(", ");
|
|
}
|
|
int i2 = i << 1;
|
|
Object obj = this.e[i2];
|
|
if (obj != this) {
|
|
sb.append(obj);
|
|
} else {
|
|
sb.append("(this Map)");
|
|
}
|
|
sb.append('=');
|
|
Object obj2 = this.e[i2 + 1];
|
|
if (obj2 != this) {
|
|
sb.append(obj2);
|
|
} else {
|
|
sb.append("(this Map)");
|
|
}
|
|
}
|
|
sb.append(UrlTreeKt.componentParamSuffixChar);
|
|
return sb.toString();
|
|
}
|
|
|
|
public boolean containsKey(Object obj) {
|
|
return (obj == null ? d() : c(obj, obj.hashCode())) >= 0;
|
|
}
|
|
|
|
public V getOrDefault(Object obj, V v) {
|
|
int d2 = obj == null ? d() : c(obj, obj.hashCode());
|
|
return d2 >= 0 ? (V) this.e[(d2 << 1) + 1] : v;
|
|
}
|
|
|
|
public V remove(Object obj) {
|
|
int d2 = obj == null ? d() : c(obj, obj.hashCode());
|
|
if (d2 >= 0) {
|
|
return c(d2);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public boolean remove(Object obj, Object obj2) {
|
|
int d2 = obj == null ? d() : c(obj, obj.hashCode());
|
|
if (d2 < 0) {
|
|
return false;
|
|
}
|
|
Object obj3 = this.e[(d2 << 1) + 1];
|
|
if (obj2 != obj3 && (obj2 == null || !obj2.equals(obj3))) {
|
|
return false;
|
|
}
|
|
c(d2);
|
|
return true;
|
|
}
|
|
|
|
public V replace(K k, V v) {
|
|
int d2 = k == null ? d() : c(k, k.hashCode());
|
|
if (d2 >= 0) {
|
|
return d(d2, v);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public boolean replace(K k, V v, V v2) {
|
|
int d2 = k == null ? d() : c(k, k.hashCode());
|
|
if (d2 < 0) {
|
|
return false;
|
|
}
|
|
Object obj = this.e[(d2 << 1) + 1];
|
|
if (obj != v && (v == null || !v.equals(obj))) {
|
|
return false;
|
|
}
|
|
d(d2, v2);
|
|
return true;
|
|
}
|
|
|
|
public int size() {
|
|
return this.b;
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
return this.b <= 0;
|
|
}
|
|
}
|