Initial commit

This commit is contained in:
2025-05-13 19:24:51 +02:00
commit a950f49678
10604 changed files with 932663 additions and 0 deletions

View File

@@ -0,0 +1,100 @@
package androidx.collection;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public class ArrayMap<K, V> extends SimpleArrayMap<K, V> implements Map<K, V> {
MapCollections<K, V> h;
public ArrayMap() {
}
private MapCollections<K, V> b() {
if (this.h == null) {
this.h = new MapCollections<K, V>() { // from class: androidx.collection.ArrayMap.1
@Override // androidx.collection.MapCollections
protected Object a(int i, int i2) {
return ArrayMap.this.b[(i << 1) + i2];
}
@Override // androidx.collection.MapCollections
protected int b(Object obj) {
return ArrayMap.this.b(obj);
}
@Override // androidx.collection.MapCollections
protected int c() {
return ArrayMap.this.c;
}
@Override // androidx.collection.MapCollections
protected int a(Object obj) {
return ArrayMap.this.a(obj);
}
@Override // androidx.collection.MapCollections
protected Map<K, V> b() {
return ArrayMap.this;
}
@Override // androidx.collection.MapCollections
protected void a(K k, V v) {
ArrayMap.this.put(k, v);
}
@Override // androidx.collection.MapCollections
protected V a(int i, V v) {
return ArrayMap.this.a(i, (int) v);
}
@Override // androidx.collection.MapCollections
protected void a(int i) {
ArrayMap.this.c(i);
}
@Override // androidx.collection.MapCollections
protected void a() {
ArrayMap.this.clear();
}
};
}
return this.h;
}
public boolean a(Collection<?> collection) {
return MapCollections.c(this, collection);
}
@Override // java.util.Map
public Set<Map.Entry<K, V>> entrySet() {
return b().d();
}
@Override // java.util.Map
public Set<K> keySet() {
return b().e();
}
@Override // java.util.Map
public void putAll(Map<? extends K, ? extends V> map) {
a(this.c + map.size());
for (Map.Entry<? extends K, ? extends V> entry : map.entrySet()) {
put(entry.getKey(), entry.getValue());
}
}
@Override // java.util.Map
public Collection<V> values() {
return b().f();
}
public ArrayMap(int i) {
super(i);
}
public ArrayMap(SimpleArrayMap simpleArrayMap) {
super(simpleArrayMap);
}
}

View File

@@ -0,0 +1,472 @@
package androidx.collection;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
/* loaded from: classes.dex */
public final class ArraySet<E> implements Collection<E>, Set<E> {
private static final int[] e = new int[0];
private static final Object[] f = new Object[0];
private static Object[] g;
private static int h;
private static Object[] i;
private static int j;
private int[] a;
Object[] b;
int c;
private MapCollections<E, E> d;
public ArraySet() {
this(0);
}
private int a(Object obj, int i2) {
int i3 = this.c;
if (i3 == 0) {
return -1;
}
int a = ContainerHelpers.a(this.a, i3, i2);
if (a < 0 || obj.equals(this.b[a])) {
return a;
}
int i4 = a + 1;
while (i4 < i3 && this.a[i4] == i2) {
if (obj.equals(this.b[i4])) {
return i4;
}
i4++;
}
for (int i5 = a - 1; i5 >= 0 && this.a[i5] == i2; i5--) {
if (obj.equals(this.b[i5])) {
return i5;
}
}
return ~i4;
}
private int b() {
int i2 = this.c;
if (i2 == 0) {
return -1;
}
int a = ContainerHelpers.a(this.a, i2, 0);
if (a < 0 || this.b[a] == null) {
return a;
}
int i3 = a + 1;
while (i3 < i2 && this.a[i3] == 0) {
if (this.b[i3] == null) {
return i3;
}
i3++;
}
for (int i4 = a - 1; i4 >= 0 && this.a[i4] == 0; i4--) {
if (this.b[i4] == null) {
return i4;
}
}
return ~i3;
}
private void f(int i2) {
if (i2 == 8) {
synchronized (ArraySet.class) {
if (i != null) {
Object[] objArr = i;
this.b = objArr;
i = (Object[]) objArr[0];
this.a = (int[]) objArr[1];
objArr[1] = null;
objArr[0] = null;
j--;
return;
}
}
} else if (i2 == 4) {
synchronized (ArraySet.class) {
if (g != null) {
Object[] objArr2 = g;
this.b = objArr2;
g = (Object[]) objArr2[0];
this.a = (int[]) objArr2[1];
objArr2[1] = null;
objArr2[0] = null;
h--;
return;
}
}
}
this.a = new int[i2];
this.b = new Object[i2];
}
@Override // java.util.Collection, java.util.Set
public boolean add(E e2) {
int i2;
int a;
if (e2 == null) {
a = b();
i2 = 0;
} else {
int hashCode = e2.hashCode();
i2 = hashCode;
a = a(e2, hashCode);
}
if (a >= 0) {
return false;
}
int i3 = ~a;
int i4 = this.c;
if (i4 >= this.a.length) {
int i5 = 4;
if (i4 >= 8) {
i5 = (i4 >> 1) + i4;
} else if (i4 >= 4) {
i5 = 8;
}
int[] iArr = this.a;
Object[] objArr = this.b;
f(i5);
int[] iArr2 = this.a;
if (iArr2.length > 0) {
System.arraycopy(iArr, 0, iArr2, 0, iArr.length);
System.arraycopy(objArr, 0, this.b, 0, objArr.length);
}
a(iArr, objArr, this.c);
}
int i6 = this.c;
if (i3 < i6) {
int[] iArr3 = this.a;
int i7 = i3 + 1;
System.arraycopy(iArr3, i3, iArr3, i7, i6 - i3);
Object[] objArr2 = this.b;
System.arraycopy(objArr2, i3, objArr2, i7, this.c - i3);
}
this.a[i3] = i2;
this.b[i3] = e2;
this.c++;
return true;
}
@Override // java.util.Collection, java.util.Set
public boolean addAll(Collection<? extends E> collection) {
c(this.c + collection.size());
Iterator<? extends E> it = collection.iterator();
boolean z = false;
while (it.hasNext()) {
z |= add(it.next());
}
return z;
}
public void c(int i2) {
int[] iArr = this.a;
if (iArr.length < i2) {
Object[] objArr = this.b;
f(i2);
int i3 = this.c;
if (i3 > 0) {
System.arraycopy(iArr, 0, this.a, 0, i3);
System.arraycopy(objArr, 0, this.b, 0, this.c);
}
a(iArr, objArr, this.c);
}
}
@Override // java.util.Collection, java.util.Set
public void clear() {
int i2 = this.c;
if (i2 != 0) {
a(this.a, this.b, i2);
this.a = e;
this.b = f;
this.c = 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;
}
public E d(int i2) {
Object[] objArr = this.b;
E e2 = (E) objArr[i2];
int i3 = this.c;
if (i3 <= 1) {
a(this.a, objArr, i3);
this.a = e;
this.b = f;
this.c = 0;
} else {
int[] iArr = this.a;
if (iArr.length <= 8 || i3 >= iArr.length / 3) {
this.c--;
int i4 = this.c;
if (i2 < i4) {
int[] iArr2 = this.a;
int i5 = i2 + 1;
System.arraycopy(iArr2, i5, iArr2, i2, i4 - i2);
Object[] objArr2 = this.b;
System.arraycopy(objArr2, i5, objArr2, i2, this.c - i2);
}
this.b[this.c] = null;
} else {
int i6 = i3 > 8 ? i3 + (i3 >> 1) : 8;
int[] iArr3 = this.a;
Object[] objArr3 = this.b;
f(i6);
this.c--;
if (i2 > 0) {
System.arraycopy(iArr3, 0, this.a, 0, i2);
System.arraycopy(objArr3, 0, this.b, 0, i2);
}
int i7 = this.c;
if (i2 < i7) {
int i8 = i2 + 1;
System.arraycopy(iArr3, i8, this.a, i2, i7 - i2);
System.arraycopy(objArr3, i8, this.b, i2, this.c - i2);
}
}
}
return e2;
}
public E e(int i2) {
return (E) this.b[i2];
}
@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 i2 = 0; i2 < this.c; i2++) {
try {
if (!set.contains(e(i2))) {
return false;
}
} catch (ClassCastException | NullPointerException unused) {
}
}
return true;
}
return false;
}
@Override // java.util.Collection, java.util.Set
public int hashCode() {
int[] iArr = this.a;
int i2 = this.c;
int i3 = 0;
for (int i4 = 0; i4 < i2; i4++) {
i3 += iArr[i4];
}
return i3;
}
public int indexOf(Object obj) {
return obj == null ? b() : a(obj, obj.hashCode());
}
@Override // java.util.Collection, java.util.Set
public boolean isEmpty() {
return this.c <= 0;
}
@Override // java.util.Collection, java.lang.Iterable, java.util.Set
public Iterator<E> iterator() {
return a().e().iterator();
}
@Override // java.util.Collection, java.util.Set
public boolean remove(Object obj) {
int indexOf = indexOf(obj);
if (indexOf < 0) {
return false;
}
d(indexOf);
return true;
}
@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 i2 = this.c - 1; i2 >= 0; i2--) {
if (!collection.contains(this.b[i2])) {
d(i2);
z = true;
}
}
return z;
}
@Override // java.util.Collection, java.util.Set
public int size() {
return this.c;
}
@Override // java.util.Collection, java.util.Set
public Object[] toArray() {
int i2 = this.c;
Object[] objArr = new Object[i2];
System.arraycopy(this.b, 0, objArr, 0, i2);
return objArr;
}
public String toString() {
if (isEmpty()) {
return "{}";
}
StringBuilder sb = new StringBuilder(this.c * 14);
sb.append('{');
for (int i2 = 0; i2 < this.c; i2++) {
if (i2 > 0) {
sb.append(", ");
}
E e2 = e(i2);
if (e2 != this) {
sb.append(e2);
} else {
sb.append("(this Set)");
}
}
sb.append('}');
return sb.toString();
}
public ArraySet(int i2) {
if (i2 == 0) {
this.a = e;
this.b = f;
} else {
f(i2);
}
this.c = 0;
}
@Override // java.util.Collection, java.util.Set
public <T> T[] toArray(T[] tArr) {
if (tArr.length < this.c) {
tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), this.c));
}
System.arraycopy(this.b, 0, tArr, 0, this.c);
int length = tArr.length;
int i2 = this.c;
if (length > i2) {
tArr[i2] = null;
}
return tArr;
}
private static void a(int[] iArr, Object[] objArr, int i2) {
if (iArr.length == 8) {
synchronized (ArraySet.class) {
if (j < 10) {
objArr[0] = i;
objArr[1] = iArr;
for (int i3 = i2 - 1; i3 >= 2; i3--) {
objArr[i3] = null;
}
i = objArr;
j++;
}
}
return;
}
if (iArr.length == 4) {
synchronized (ArraySet.class) {
if (h < 10) {
objArr[0] = g;
objArr[1] = iArr;
for (int i4 = i2 - 1; i4 >= 2; i4--) {
objArr[i4] = null;
}
g = objArr;
h++;
}
}
}
}
private MapCollections<E, E> a() {
if (this.d == null) {
this.d = new MapCollections<E, E>() { // from class: androidx.collection.ArraySet.1
@Override // androidx.collection.MapCollections
protected Object a(int i2, int i3) {
return ArraySet.this.b[i2];
}
@Override // androidx.collection.MapCollections
protected int b(Object obj) {
return ArraySet.this.indexOf(obj);
}
@Override // androidx.collection.MapCollections
protected int c() {
return ArraySet.this.c;
}
@Override // androidx.collection.MapCollections
protected int a(Object obj) {
return ArraySet.this.indexOf(obj);
}
@Override // androidx.collection.MapCollections
protected Map<E, E> b() {
throw new UnsupportedOperationException("not a map");
}
@Override // androidx.collection.MapCollections
protected void a(E e2, E e3) {
ArraySet.this.add(e2);
}
@Override // androidx.collection.MapCollections
protected E a(int i2, E e2) {
throw new UnsupportedOperationException("not a map");
}
@Override // androidx.collection.MapCollections
protected void a(int i2) {
ArraySet.this.d(i2);
}
@Override // androidx.collection.MapCollections
protected void a() {
ArraySet.this.clear();
}
};
}
return this.d;
}
}

View File

@@ -0,0 +1,66 @@
package androidx.collection;
/* loaded from: classes.dex */
class ContainerHelpers {
static final int[] a = new int[0];
static final long[] b = new long[0];
static final Object[] c = new Object[0];
public static int a(int i) {
for (int i2 = 4; i2 < 32; i2++) {
int i3 = (1 << i2) - 12;
if (i <= i3) {
return i3;
}
}
return i;
}
public static boolean a(Object obj, Object obj2) {
return obj == obj2 || (obj != null && obj.equals(obj2));
}
public static int b(int i) {
return a(i * 4) / 4;
}
public static int c(int i) {
return a(i * 8) / 8;
}
static int a(int[] iArr, int i, int i2) {
int i3 = i - 1;
int i4 = 0;
while (i4 <= i3) {
int i5 = (i4 + i3) >>> 1;
int i6 = iArr[i5];
if (i6 < i2) {
i4 = i5 + 1;
} else {
if (i6 <= i2) {
return i5;
}
i3 = i5 - 1;
}
}
return ~i4;
}
static int a(long[] jArr, int i, long j) {
int i2 = i - 1;
int i3 = 0;
while (i3 <= i2) {
int i4 = (i3 + i2) >>> 1;
long j2 = jArr[i4];
if (j2 < j) {
i3 = i4 + 1;
} else {
if (j2 <= j) {
return i4;
}
i2 = i4 - 1;
}
}
return ~i3;
}
}

View File

@@ -0,0 +1,228 @@
package androidx.collection;
/* loaded from: classes.dex */
public class LongSparseArray<E> implements Cloneable {
private static final Object e = new Object();
private boolean a;
private long[] b;
private Object[] c;
private int d;
public LongSparseArray() {
this(10);
}
private void h() {
int i = this.d;
long[] jArr = this.b;
Object[] objArr = this.c;
int i2 = 0;
for (int i3 = 0; i3 < i; i3++) {
Object obj = objArr[i3];
if (obj != e) {
if (i3 != i2) {
jArr[i2] = jArr[i3];
objArr[i2] = obj;
objArr[i3] = null;
}
i2++;
}
}
this.a = false;
this.d = i2;
}
public void a(long j) {
int a = ContainerHelpers.a(this.b, this.d, j);
if (a >= 0) {
Object[] objArr = this.c;
Object obj = objArr[a];
Object obj2 = e;
if (obj != obj2) {
objArr[a] = obj2;
this.a = true;
}
}
}
public E b(long j) {
return b(j, null);
}
public void c(long j, E e2) {
int a = ContainerHelpers.a(this.b, this.d, j);
if (a >= 0) {
this.c[a] = e2;
return;
}
int i = ~a;
if (i < this.d) {
Object[] objArr = this.c;
if (objArr[i] == e) {
this.b[i] = j;
objArr[i] = e2;
return;
}
}
if (this.a && this.d >= this.b.length) {
h();
i = ~ContainerHelpers.a(this.b, this.d, j);
}
int i2 = this.d;
if (i2 >= this.b.length) {
int c = ContainerHelpers.c(i2 + 1);
long[] jArr = new long[c];
Object[] objArr2 = new Object[c];
long[] jArr2 = this.b;
System.arraycopy(jArr2, 0, jArr, 0, jArr2.length);
Object[] objArr3 = this.c;
System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
this.b = jArr;
this.c = objArr2;
}
int i3 = this.d;
if (i3 - i != 0) {
long[] jArr3 = this.b;
int i4 = i + 1;
System.arraycopy(jArr3, i, jArr3, i4, i3 - i);
Object[] objArr4 = this.c;
System.arraycopy(objArr4, i, objArr4, i4, this.d - i);
}
this.b[i] = j;
this.c[i] = e2;
this.d++;
}
public String toString() {
if (b() <= 0) {
return "{}";
}
StringBuilder sb = new StringBuilder(this.d * 28);
sb.append('{');
for (int i = 0; i < this.d; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append(a(i));
sb.append('=');
E c = c(i);
if (c != this) {
sb.append(c);
} else {
sb.append("(this Map)");
}
}
sb.append('}');
return sb.toString();
}
public LongSparseArray(int i) {
this.a = false;
if (i == 0) {
this.b = ContainerHelpers.b;
this.c = ContainerHelpers.c;
} else {
int c = ContainerHelpers.c(i);
this.b = new long[c];
this.c = new Object[c];
}
this.d = 0;
}
public E b(long j, E e2) {
int a = ContainerHelpers.a(this.b, this.d, j);
if (a >= 0) {
Object[] objArr = this.c;
if (objArr[a] != e) {
return (E) objArr[a];
}
}
return e2;
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public LongSparseArray<E> m0clone() {
try {
LongSparseArray<E> longSparseArray = (LongSparseArray) super.clone();
longSparseArray.b = (long[]) this.b.clone();
longSparseArray.c = (Object[]) this.c.clone();
return longSparseArray;
} catch (CloneNotSupportedException e2) {
throw new AssertionError(e2);
}
}
public long a(int i) {
if (this.a) {
h();
}
return this.b[i];
}
public void b(int i) {
Object[] objArr = this.c;
Object obj = objArr[i];
Object obj2 = e;
if (obj != obj2) {
objArr[i] = obj2;
this.a = true;
}
}
public void a() {
int i = this.d;
Object[] objArr = this.c;
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = null;
}
this.d = 0;
this.a = false;
}
public int b() {
if (this.a) {
h();
}
return this.d;
}
public void a(long j, E e2) {
int i = this.d;
if (i != 0 && j <= this.b[i - 1]) {
c(j, e2);
return;
}
if (this.a && this.d >= this.b.length) {
h();
}
int i2 = this.d;
if (i2 >= this.b.length) {
int c = ContainerHelpers.c(i2 + 1);
long[] jArr = new long[c];
Object[] objArr = new Object[c];
long[] jArr2 = this.b;
System.arraycopy(jArr2, 0, jArr, 0, jArr2.length);
Object[] objArr2 = this.c;
System.arraycopy(objArr2, 0, objArr, 0, objArr2.length);
this.b = jArr;
this.c = objArr;
}
this.b[i2] = j;
this.c[i2] = e2;
this.d = i2 + 1;
}
public E c(int i) {
if (this.a) {
h();
}
return (E) this.c[i];
}
public int c(long j) {
if (this.a) {
h();
}
return ContainerHelpers.a(this.b, this.d, j);
}
}

View File

@@ -0,0 +1,179 @@
package androidx.collection;
import java.util.LinkedHashMap;
import java.util.Locale;
/* loaded from: classes.dex */
public class LruCache<K, V> {
private final LinkedHashMap<K, V> a;
private int b;
private int c;
private int d;
private int e;
private int f;
private int g;
private int h;
public LruCache(int i) {
if (i <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
this.c = i;
this.a = new LinkedHashMap<>(0, 0.75f, true);
}
private int c(K k, V v) {
int b = b(k, v);
if (b >= 0) {
return b;
}
throw new IllegalStateException("Negative size: " + k + "=" + v);
}
protected V a(K k) {
return null;
}
public final V a(K k, V v) {
V put;
if (k == null || v == null) {
throw new NullPointerException("key == null || value == null");
}
synchronized (this) {
this.d++;
this.b += c(k, v);
put = this.a.put(k, v);
if (put != null) {
this.b -= c(k, put);
}
}
if (put != null) {
a(false, k, put, v);
}
a(this.c);
return put;
}
protected void a(boolean z, K k, V v, V v2) {
}
protected int b(K k, V v) {
return 1;
}
public final V b(K k) {
V v;
if (k == null) {
throw new NullPointerException("key == null");
}
synchronized (this) {
V v2 = this.a.get(k);
if (v2 != null) {
this.g++;
return v2;
}
this.h++;
V a = a((LruCache<K, V>) k);
if (a == null) {
return null;
}
synchronized (this) {
this.e++;
v = (V) this.a.put(k, a);
if (v != null) {
this.a.put(k, v);
} else {
this.b += c(k, a);
}
}
if (v != null) {
a(false, k, a, v);
return v;
}
a(this.c);
return a;
}
}
public final synchronized String toString() {
int i;
i = this.g + this.h;
return String.format(Locale.US, "LruCache[maxSize=%d,hits=%d,misses=%d,hitRate=%d%%]", Integer.valueOf(this.c), Integer.valueOf(this.g), Integer.valueOf(this.h), Integer.valueOf(i != 0 ? (this.g * 100) / i : 0));
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0070, code lost:
throw new java.lang.IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
*/
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct code enable 'Show inconsistent code' option in preferences
*/
public void a(int r5) {
/*
r4 = this;
L0:
monitor-enter(r4)
int r0 = r4.b // Catch: java.lang.Throwable -> L71
if (r0 < 0) goto L52
java.util.LinkedHashMap<K, V> r0 = r4.a // Catch: java.lang.Throwable -> L71
boolean r0 = r0.isEmpty() // Catch: java.lang.Throwable -> L71
if (r0 == 0) goto L11
int r0 = r4.b // Catch: java.lang.Throwable -> L71
if (r0 != 0) goto L52
L11:
int r0 = r4.b // Catch: java.lang.Throwable -> L71
if (r0 <= r5) goto L50
java.util.LinkedHashMap<K, V> r0 = r4.a // Catch: java.lang.Throwable -> L71
boolean r0 = r0.isEmpty() // Catch: java.lang.Throwable -> L71
if (r0 == 0) goto L1e
goto L50
L1e:
java.util.LinkedHashMap<K, V> r0 = r4.a // Catch: java.lang.Throwable -> L71
java.util.Set r0 = r0.entrySet() // Catch: java.lang.Throwable -> L71
java.util.Iterator r0 = r0.iterator() // Catch: java.lang.Throwable -> L71
java.lang.Object r0 = r0.next() // Catch: java.lang.Throwable -> L71
java.util.Map$Entry r0 = (java.util.Map.Entry) r0 // Catch: java.lang.Throwable -> L71
java.lang.Object r1 = r0.getKey() // Catch: java.lang.Throwable -> L71
java.lang.Object r0 = r0.getValue() // Catch: java.lang.Throwable -> L71
java.util.LinkedHashMap<K, V> r2 = r4.a // Catch: java.lang.Throwable -> L71
r2.remove(r1) // Catch: java.lang.Throwable -> L71
int r2 = r4.b // Catch: java.lang.Throwable -> L71
int r3 = r4.c(r1, r0) // Catch: java.lang.Throwable -> L71
int r2 = r2 - r3
r4.b = r2 // Catch: java.lang.Throwable -> L71
int r2 = r4.f // Catch: java.lang.Throwable -> L71
r3 = 1
int r2 = r2 + r3
r4.f = r2 // Catch: java.lang.Throwable -> L71
monitor-exit(r4) // Catch: java.lang.Throwable -> L71
r2 = 0
r4.a(r3, r1, r0, r2)
goto L0
L50:
monitor-exit(r4) // Catch: java.lang.Throwable -> L71
return
L52:
java.lang.IllegalStateException r5 = new java.lang.IllegalStateException // Catch: java.lang.Throwable -> L71
java.lang.StringBuilder r0 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L71
r0.<init>() // Catch: java.lang.Throwable -> L71
java.lang.Class r1 = r4.getClass() // Catch: java.lang.Throwable -> L71
java.lang.String r1 = r1.getName() // Catch: java.lang.Throwable -> L71
r0.append(r1) // Catch: java.lang.Throwable -> L71
java.lang.String r1 = ".sizeOf() is reporting inconsistent results!"
r0.append(r1) // Catch: java.lang.Throwable -> L71
java.lang.String r0 = r0.toString() // Catch: java.lang.Throwable -> L71
r5.<init>(r0) // Catch: java.lang.Throwable -> L71
throw r5 // Catch: java.lang.Throwable -> L71
L71:
r5 = move-exception
monitor-exit(r4) // Catch: java.lang.Throwable -> L71
throw r5
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.collection.LruCache.a(int):void");
}
public final void a() {
a(-1);
}
}

View File

@@ -0,0 +1,564 @@
package androidx.collection;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
/* loaded from: classes.dex */
abstract class MapCollections<K, V> {
MapCollections<K, V>.EntrySet a;
MapCollections<K, V>.KeySet b;
MapCollections<K, V>.ValuesCollection c;
final class ArrayIterator<T> implements Iterator<T> {
final int a;
int b;
int c;
boolean d = false;
ArrayIterator(int i) {
this.a = i;
this.b = MapCollections.this.c();
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.c < this.b;
}
@Override // java.util.Iterator
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
T t = (T) MapCollections.this.a(this.c, this.a);
this.c++;
this.d = true;
return t;
}
@Override // java.util.Iterator
public void remove() {
if (!this.d) {
throw new IllegalStateException();
}
this.c--;
this.b--;
this.d = false;
MapCollections.this.a(this.c);
}
}
final class EntrySet implements Set<Map.Entry<K, V>> {
EntrySet() {
}
public boolean a(Map.Entry<K, V> entry) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public /* bridge */ /* synthetic */ boolean add(Object obj) {
a((Map.Entry) obj);
throw null;
}
@Override // java.util.Set, java.util.Collection
public boolean addAll(Collection<? extends Map.Entry<K, V>> collection) {
int c = MapCollections.this.c();
for (Map.Entry<K, V> entry : collection) {
MapCollections.this.a((MapCollections) entry.getKey(), (K) entry.getValue());
}
return c != MapCollections.this.c();
}
@Override // java.util.Set, java.util.Collection
public void clear() {
MapCollections.this.a();
}
@Override // java.util.Set, java.util.Collection
public boolean contains(Object obj) {
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
int a = MapCollections.this.a(entry.getKey());
if (a < 0) {
return false;
}
return ContainerHelpers.a(MapCollections.this.a(a, 1), entry.getValue());
}
@Override // java.util.Set, java.util.Collection
public boolean containsAll(Collection<?> collection) {
Iterator<?> it = collection.iterator();
while (it.hasNext()) {
if (!contains(it.next())) {
return false;
}
}
return true;
}
@Override // java.util.Set, java.util.Collection
public boolean equals(Object obj) {
return MapCollections.a((Set) this, obj);
}
@Override // java.util.Set, java.util.Collection
public int hashCode() {
int i = 0;
for (int c = MapCollections.this.c() - 1; c >= 0; c--) {
Object a = MapCollections.this.a(c, 0);
Object a2 = MapCollections.this.a(c, 1);
i += (a == null ? 0 : a.hashCode()) ^ (a2 == null ? 0 : a2.hashCode());
}
return i;
}
@Override // java.util.Set, java.util.Collection
public boolean isEmpty() {
return MapCollections.this.c() == 0;
}
@Override // java.util.Set, java.util.Collection, java.lang.Iterable
public Iterator<Map.Entry<K, V>> iterator() {
return new MapIterator();
}
@Override // java.util.Set, java.util.Collection
public boolean remove(Object obj) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public boolean removeAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public boolean retainAll(Collection<?> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public int size() {
return MapCollections.this.c();
}
@Override // java.util.Set, java.util.Collection
public Object[] toArray() {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public <T> T[] toArray(T[] tArr) {
throw new UnsupportedOperationException();
}
}
final class KeySet implements Set<K> {
KeySet() {
}
@Override // java.util.Set, java.util.Collection
public boolean add(K k) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public boolean addAll(Collection<? extends K> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Set, java.util.Collection
public void clear() {
MapCollections.this.a();
}
@Override // java.util.Set, java.util.Collection
public boolean contains(Object obj) {
return MapCollections.this.a(obj) >= 0;
}
@Override // java.util.Set, java.util.Collection
public boolean containsAll(Collection<?> collection) {
return MapCollections.a((Map) MapCollections.this.b(), collection);
}
@Override // java.util.Set, java.util.Collection
public boolean equals(Object obj) {
return MapCollections.a((Set) this, obj);
}
@Override // java.util.Set, java.util.Collection
public int hashCode() {
int i = 0;
for (int c = MapCollections.this.c() - 1; c >= 0; c--) {
Object a = MapCollections.this.a(c, 0);
i += a == null ? 0 : a.hashCode();
}
return i;
}
@Override // java.util.Set, java.util.Collection
public boolean isEmpty() {
return MapCollections.this.c() == 0;
}
@Override // java.util.Set, java.util.Collection, java.lang.Iterable
public Iterator<K> iterator() {
return new ArrayIterator(0);
}
@Override // java.util.Set, java.util.Collection
public boolean remove(Object obj) {
int a = MapCollections.this.a(obj);
if (a < 0) {
return false;
}
MapCollections.this.a(a);
return true;
}
@Override // java.util.Set, java.util.Collection
public boolean removeAll(Collection<?> collection) {
return MapCollections.b(MapCollections.this.b(), collection);
}
@Override // java.util.Set, java.util.Collection
public boolean retainAll(Collection<?> collection) {
return MapCollections.c(MapCollections.this.b(), collection);
}
@Override // java.util.Set, java.util.Collection
public int size() {
return MapCollections.this.c();
}
@Override // java.util.Set, java.util.Collection
public Object[] toArray() {
return MapCollections.this.b(0);
}
@Override // java.util.Set, java.util.Collection
public <T> T[] toArray(T[] tArr) {
return (T[]) MapCollections.this.a(tArr, 0);
}
}
final class MapIterator implements Iterator<Map.Entry<K, V>>, Map.Entry<K, V> {
int a;
boolean c = false;
int b = -1;
MapIterator() {
this.a = MapCollections.this.c() - 1;
}
@Override // java.util.Map.Entry
public boolean equals(Object obj) {
if (!this.c) {
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
if (!(obj instanceof Map.Entry)) {
return false;
}
Map.Entry entry = (Map.Entry) obj;
return ContainerHelpers.a(entry.getKey(), MapCollections.this.a(this.b, 0)) && ContainerHelpers.a(entry.getValue(), MapCollections.this.a(this.b, 1));
}
@Override // java.util.Map.Entry
public K getKey() {
if (this.c) {
return (K) MapCollections.this.a(this.b, 0);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Map.Entry
public V getValue() {
if (this.c) {
return (V) MapCollections.this.a(this.b, 1);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
@Override // java.util.Iterator
public boolean hasNext() {
return this.b < this.a;
}
@Override // java.util.Map.Entry
public int hashCode() {
if (!this.c) {
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
Object a = MapCollections.this.a(this.b, 0);
Object a2 = MapCollections.this.a(this.b, 1);
return (a == null ? 0 : a.hashCode()) ^ (a2 != null ? a2.hashCode() : 0);
}
@Override // java.util.Iterator
public /* bridge */ /* synthetic */ Object next() {
next();
return this;
}
@Override // java.util.Iterator
public void remove() {
if (!this.c) {
throw new IllegalStateException();
}
MapCollections.this.a(this.b);
this.b--;
this.a--;
this.c = false;
}
@Override // java.util.Map.Entry
public V setValue(V v) {
if (this.c) {
return (V) MapCollections.this.a(this.b, (int) v);
}
throw new IllegalStateException("This container does not support retaining Map.Entry objects");
}
public String toString() {
return getKey() + "=" + getValue();
}
@Override // java.util.Iterator
public Map.Entry<K, V> next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
this.b++;
this.c = true;
return this;
}
}
final class ValuesCollection implements Collection<V> {
ValuesCollection() {
}
@Override // java.util.Collection
public boolean add(V v) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection
public boolean addAll(Collection<? extends V> collection) {
throw new UnsupportedOperationException();
}
@Override // java.util.Collection
public void clear() {
MapCollections.this.a();
}
@Override // java.util.Collection
public boolean contains(Object obj) {
return MapCollections.this.b(obj) >= 0;
}
@Override // java.util.Collection
public boolean containsAll(Collection<?> collection) {
Iterator<?> it = collection.iterator();
while (it.hasNext()) {
if (!contains(it.next())) {
return false;
}
}
return true;
}
@Override // java.util.Collection
public boolean isEmpty() {
return MapCollections.this.c() == 0;
}
@Override // java.util.Collection, java.lang.Iterable
public Iterator<V> iterator() {
return new ArrayIterator(1);
}
@Override // java.util.Collection
public boolean remove(Object obj) {
int b = MapCollections.this.b(obj);
if (b < 0) {
return false;
}
MapCollections.this.a(b);
return true;
}
@Override // java.util.Collection
public boolean removeAll(Collection<?> collection) {
int c = MapCollections.this.c();
int i = 0;
boolean z = false;
while (i < c) {
if (collection.contains(MapCollections.this.a(i, 1))) {
MapCollections.this.a(i);
i--;
c--;
z = true;
}
i++;
}
return z;
}
@Override // java.util.Collection
public boolean retainAll(Collection<?> collection) {
int c = MapCollections.this.c();
int i = 0;
boolean z = false;
while (i < c) {
if (!collection.contains(MapCollections.this.a(i, 1))) {
MapCollections.this.a(i);
i--;
c--;
z = true;
}
i++;
}
return z;
}
@Override // java.util.Collection
public int size() {
return MapCollections.this.c();
}
@Override // java.util.Collection
public Object[] toArray() {
return MapCollections.this.b(1);
}
@Override // java.util.Collection
public <T> T[] toArray(T[] tArr) {
return (T[]) MapCollections.this.a(tArr, 1);
}
}
MapCollections() {
}
public static <K, V> boolean a(Map<K, V> map, Collection<?> collection) {
Iterator<?> it = collection.iterator();
while (it.hasNext()) {
if (!map.containsKey(it.next())) {
return false;
}
}
return true;
}
public static <K, V> boolean b(Map<K, V> map, Collection<?> collection) {
int size = map.size();
Iterator<?> it = collection.iterator();
while (it.hasNext()) {
map.remove(it.next());
}
return size != map.size();
}
public static <K, V> boolean c(Map<K, V> map, Collection<?> collection) {
int size = map.size();
Iterator<K> it = map.keySet().iterator();
while (it.hasNext()) {
if (!collection.contains(it.next())) {
it.remove();
}
}
return size != map.size();
}
protected abstract int a(Object obj);
protected abstract Object a(int i, int i2);
protected abstract V a(int i, V v);
protected abstract void a();
protected abstract void a(int i);
protected abstract void a(K k, V v);
protected abstract int b(Object obj);
protected abstract Map<K, V> b();
protected abstract int c();
public Set<Map.Entry<K, V>> d() {
if (this.a == null) {
this.a = new EntrySet();
}
return this.a;
}
public Set<K> e() {
if (this.b == null) {
this.b = new KeySet();
}
return this.b;
}
public Collection<V> f() {
if (this.c == null) {
this.c = new ValuesCollection();
}
return this.c;
}
public <T> T[] a(T[] tArr, int i) {
int c = c();
if (tArr.length < c) {
tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), c));
}
for (int i2 = 0; i2 < c; i2++) {
tArr[i2] = a(i2, i);
}
if (tArr.length > c) {
tArr[c] = null;
}
return tArr;
}
public Object[] b(int i) {
int c = c();
Object[] objArr = new Object[c];
for (int i2 = 0; i2 < c; i2++) {
objArr[i2] = a(i2, i);
}
return objArr;
}
public static <T> boolean a(Set<T> set, Object obj) {
if (set == obj) {
return true;
}
if (obj instanceof Set) {
Set set2 = (Set) obj;
try {
if (set.size() == set2.size()) {
if (set.containsAll(set2)) {
return true;
}
}
return false;
} catch (ClassCastException | NullPointerException unused) {
}
}
return false;
}
}

View File

@@ -0,0 +1,487 @@
package androidx.collection;
import java.util.ConcurrentModificationException;
import java.util.Map;
/* loaded from: classes.dex */
public class SimpleArrayMap<K, V> {
static Object[] d;
static int e;
static Object[] f;
static int g;
int[] a;
Object[] b;
int c;
public SimpleArrayMap() {
this.a = ContainerHelpers.a;
this.b = ContainerHelpers.c;
this.c = 0;
}
private static int a(int[] iArr, int i, int i2) {
try {
return ContainerHelpers.a(iArr, i, i2);
} catch (ArrayIndexOutOfBoundsException unused) {
throw new ConcurrentModificationException();
}
}
private void e(int i) {
if (i == 8) {
synchronized (ArrayMap.class) {
if (f != null) {
Object[] objArr = f;
this.b = objArr;
f = (Object[]) objArr[0];
this.a = (int[]) objArr[1];
objArr[1] = null;
objArr[0] = null;
g--;
return;
}
}
} else if (i == 4) {
synchronized (ArrayMap.class) {
if (d != null) {
Object[] objArr2 = d;
this.b = objArr2;
d = (Object[]) objArr2[0];
this.a = (int[]) objArr2[1];
objArr2[1] = null;
objArr2[0] = null;
e--;
return;
}
}
}
this.a = new int[i];
this.b = new Object[i << 1];
}
int b(Object obj) {
int i = this.c * 2;
Object[] objArr = this.b;
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 V c(int i) {
int i2;
Object[] objArr = this.b;
int i3 = i << 1;
V v = (V) objArr[i3 + 1];
int i4 = this.c;
if (i4 <= 1) {
a(this.a, objArr, i4);
this.a = ContainerHelpers.a;
this.b = ContainerHelpers.c;
i2 = 0;
} else {
i2 = i4 - 1;
int[] iArr = this.a;
if (iArr.length <= 8 || i4 >= iArr.length / 3) {
if (i < i2) {
int[] iArr2 = this.a;
int i5 = i + 1;
int i6 = i2 - i;
System.arraycopy(iArr2, i5, iArr2, i, i6);
Object[] objArr2 = this.b;
System.arraycopy(objArr2, i5 << 1, objArr2, i3, i6 << 1);
}
Object[] objArr3 = this.b;
int i7 = i2 << 1;
objArr3[i7] = null;
objArr3[i7 + 1] = null;
} else {
int i8 = i4 > 8 ? i4 + (i4 >> 1) : 8;
int[] iArr3 = this.a;
Object[] objArr4 = this.b;
e(i8);
if (i4 != this.c) {
throw new ConcurrentModificationException();
}
if (i > 0) {
System.arraycopy(iArr3, 0, this.a, 0, i);
System.arraycopy(objArr4, 0, this.b, 0, i3);
}
if (i < i2) {
int i9 = i + 1;
int i10 = i2 - i;
System.arraycopy(iArr3, i9, this.a, i, i10);
System.arraycopy(objArr4, i9 << 1, this.b, i3, i10 << 1);
}
}
}
if (i4 != this.c) {
throw new ConcurrentModificationException();
}
this.c = i2;
return v;
}
public void clear() {
int i = this.c;
if (i > 0) {
int[] iArr = this.a;
Object[] objArr = this.b;
this.a = ContainerHelpers.a;
this.b = ContainerHelpers.c;
this.c = 0;
a(iArr, objArr, i);
}
if (this.c > 0) {
throw new ConcurrentModificationException();
}
}
public boolean containsKey(Object obj) {
return a(obj) >= 0;
}
public boolean containsValue(Object obj) {
return b(obj) >= 0;
}
public V d(int i) {
return (V) this.b[(i << 1) + 1];
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj instanceof SimpleArrayMap) {
SimpleArrayMap simpleArrayMap = (SimpleArrayMap) obj;
if (size() != simpleArrayMap.size()) {
return false;
}
for (int i = 0; i < this.c; i++) {
try {
K b = b(i);
V d2 = d(i);
Object obj2 = simpleArrayMap.get(b);
if (d2 == null) {
if (obj2 != null || !simpleArrayMap.containsKey(b)) {
return false;
}
} else if (!d2.equals(obj2)) {
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 i2 = 0; i2 < this.c; i2++) {
try {
K b2 = b(i2);
V d3 = d(i2);
Object obj3 = map.get(b2);
if (d3 == null) {
if (obj3 != null || !map.containsKey(b2)) {
return false;
}
} else if (!d3.equals(obj3)) {
return false;
}
} catch (ClassCastException | NullPointerException unused2) {
}
}
return true;
}
return false;
}
public V get(Object obj) {
int a = a(obj);
if (a >= 0) {
return (V) this.b[(a << 1) + 1];
}
return null;
}
public int hashCode() {
int[] iArr = this.a;
Object[] objArr = this.b;
int i = this.c;
int i2 = 0;
int i3 = 0;
int i4 = 1;
while (i2 < i) {
Object obj = objArr[i4];
i3 += (obj == null ? 0 : obj.hashCode()) ^ iArr[i2];
i2++;
i4 += 2;
}
return i3;
}
public boolean isEmpty() {
return this.c <= 0;
}
public V put(K k, V v) {
int i;
int a;
int i2 = this.c;
if (k == null) {
a = a();
i = 0;
} else {
int hashCode = k.hashCode();
i = hashCode;
a = a(k, hashCode);
}
if (a >= 0) {
int i3 = (a << 1) + 1;
Object[] objArr = this.b;
V v2 = (V) objArr[i3];
objArr[i3] = v;
return v2;
}
int i4 = ~a;
if (i2 >= this.a.length) {
int i5 = 4;
if (i2 >= 8) {
i5 = (i2 >> 1) + i2;
} else if (i2 >= 4) {
i5 = 8;
}
int[] iArr = this.a;
Object[] objArr2 = this.b;
e(i5);
if (i2 != this.c) {
throw new ConcurrentModificationException();
}
int[] iArr2 = this.a;
if (iArr2.length > 0) {
System.arraycopy(iArr, 0, iArr2, 0, iArr.length);
System.arraycopy(objArr2, 0, this.b, 0, objArr2.length);
}
a(iArr, objArr2, i2);
}
if (i4 < i2) {
int[] iArr3 = this.a;
int i6 = i4 + 1;
System.arraycopy(iArr3, i4, iArr3, i6, i2 - i4);
Object[] objArr3 = this.b;
System.arraycopy(objArr3, i4 << 1, objArr3, i6 << 1, (this.c - i4) << 1);
}
int i7 = this.c;
if (i2 == i7) {
int[] iArr4 = this.a;
if (i4 < iArr4.length) {
iArr4[i4] = i;
Object[] objArr4 = this.b;
int i8 = i4 << 1;
objArr4[i8] = k;
objArr4[i8 + 1] = v;
this.c = i7 + 1;
return null;
}
}
throw new ConcurrentModificationException();
}
public V remove(Object obj) {
int a = a(obj);
if (a >= 0) {
return c(a);
}
return null;
}
public int size() {
return this.c;
}
public String toString() {
if (isEmpty()) {
return "{}";
}
StringBuilder sb = new StringBuilder(this.c * 28);
sb.append('{');
for (int i = 0; i < this.c; i++) {
if (i > 0) {
sb.append(", ");
}
K b = b(i);
if (b != this) {
sb.append(b);
} else {
sb.append("(this Map)");
}
sb.append('=');
V d2 = d(i);
if (d2 != this) {
sb.append(d2);
} else {
sb.append("(this Map)");
}
}
sb.append('}');
return sb.toString();
}
int a(Object obj, int i) {
int i2 = this.c;
if (i2 == 0) {
return -1;
}
int a = a(this.a, i2, i);
if (a < 0 || obj.equals(this.b[a << 1])) {
return a;
}
int i3 = a + 1;
while (i3 < i2 && this.a[i3] == i) {
if (obj.equals(this.b[i3 << 1])) {
return i3;
}
i3++;
}
for (int i4 = a - 1; i4 >= 0 && this.a[i4] == i; i4--) {
if (obj.equals(this.b[i4 << 1])) {
return i4;
}
}
return ~i3;
}
public SimpleArrayMap(int i) {
if (i == 0) {
this.a = ContainerHelpers.a;
this.b = ContainerHelpers.c;
} else {
e(i);
}
this.c = 0;
}
public K b(int i) {
return (K) this.b[i << 1];
}
/* JADX WARN: Multi-variable type inference failed */
public SimpleArrayMap(SimpleArrayMap<K, V> simpleArrayMap) {
this();
if (simpleArrayMap != 0) {
a((SimpleArrayMap) simpleArrayMap);
}
}
int a() {
int i = this.c;
if (i == 0) {
return -1;
}
int a = a(this.a, i, 0);
if (a < 0 || this.b[a << 1] == null) {
return a;
}
int i2 = a + 1;
while (i2 < i && this.a[i2] == 0) {
if (this.b[i2 << 1] == null) {
return i2;
}
i2++;
}
for (int i3 = a - 1; i3 >= 0 && this.a[i3] == 0; i3--) {
if (this.b[i3 << 1] == null) {
return i3;
}
}
return ~i2;
}
private static void a(int[] iArr, Object[] objArr, int i) {
if (iArr.length == 8) {
synchronized (ArrayMap.class) {
if (g < 10) {
objArr[0] = f;
objArr[1] = iArr;
for (int i2 = (i << 1) - 1; i2 >= 2; i2--) {
objArr[i2] = null;
}
f = objArr;
g++;
}
}
return;
}
if (iArr.length == 4) {
synchronized (ArrayMap.class) {
if (e < 10) {
objArr[0] = d;
objArr[1] = iArr;
for (int i3 = (i << 1) - 1; i3 >= 2; i3--) {
objArr[i3] = null;
}
d = objArr;
e++;
}
}
}
}
public void a(int i) {
int i2 = this.c;
int[] iArr = this.a;
if (iArr.length < i) {
Object[] objArr = this.b;
e(i);
if (this.c > 0) {
System.arraycopy(iArr, 0, this.a, 0, i2);
System.arraycopy(objArr, 0, this.b, 0, i2 << 1);
}
a(iArr, objArr, i2);
}
if (this.c != i2) {
throw new ConcurrentModificationException();
}
}
public int a(Object obj) {
return obj == null ? a() : a(obj, obj.hashCode());
}
public V a(int i, V v) {
int i2 = (i << 1) + 1;
Object[] objArr = this.b;
V v2 = (V) objArr[i2];
objArr[i2] = v;
return v2;
}
public void a(SimpleArrayMap<? extends K, ? extends V> simpleArrayMap) {
int i = simpleArrayMap.c;
a(this.c + i);
if (this.c != 0) {
for (int i2 = 0; i2 < i; i2++) {
put(simpleArrayMap.b(i2), simpleArrayMap.d(i2));
}
} else if (i > 0) {
System.arraycopy(simpleArrayMap.a, 0, this.a, 0, i);
System.arraycopy(simpleArrayMap.b, 0, this.b, 0, i << 1);
this.c = i;
}
}
}

View File

@@ -0,0 +1,222 @@
package androidx.collection;
/* loaded from: classes.dex */
public class SparseArrayCompat<E> implements Cloneable {
private static final Object e = new Object();
private boolean a;
private int[] b;
private Object[] c;
private int d;
public SparseArrayCompat() {
this(10);
}
private void h() {
int i = this.d;
int[] iArr = this.b;
Object[] objArr = this.c;
int i2 = 0;
for (int i3 = 0; i3 < i; i3++) {
Object obj = objArr[i3];
if (obj != e) {
if (i3 != i2) {
iArr[i2] = iArr[i3];
objArr[i2] = obj;
objArr[i3] = null;
}
i2++;
}
}
this.a = false;
this.d = i2;
}
public void a(int i) {
int a = ContainerHelpers.a(this.b, this.d, i);
if (a >= 0) {
Object[] objArr = this.c;
Object obj = objArr[a];
Object obj2 = e;
if (obj != obj2) {
objArr[a] = obj2;
this.a = true;
}
}
}
public E b(int i) {
return b(i, null);
}
public void c(int i, E e2) {
int a = ContainerHelpers.a(this.b, this.d, i);
if (a >= 0) {
this.c[a] = e2;
return;
}
int i2 = ~a;
if (i2 < this.d) {
Object[] objArr = this.c;
if (objArr[i2] == e) {
this.b[i2] = i;
objArr[i2] = e2;
return;
}
}
if (this.a && this.d >= this.b.length) {
h();
i2 = ~ContainerHelpers.a(this.b, this.d, i);
}
int i3 = this.d;
if (i3 >= this.b.length) {
int b = ContainerHelpers.b(i3 + 1);
int[] iArr = new int[b];
Object[] objArr2 = new Object[b];
int[] iArr2 = this.b;
System.arraycopy(iArr2, 0, iArr, 0, iArr2.length);
Object[] objArr3 = this.c;
System.arraycopy(objArr3, 0, objArr2, 0, objArr3.length);
this.b = iArr;
this.c = objArr2;
}
int i4 = this.d;
if (i4 - i2 != 0) {
int[] iArr3 = this.b;
int i5 = i2 + 1;
System.arraycopy(iArr3, i2, iArr3, i5, i4 - i2);
Object[] objArr4 = this.c;
System.arraycopy(objArr4, i2, objArr4, i5, this.d - i2);
}
this.b[i2] = i;
this.c[i2] = e2;
this.d++;
}
public int d(int i) {
if (this.a) {
h();
}
return this.b[i];
}
public void e(int i) {
a(i);
}
public E f(int i) {
if (this.a) {
h();
}
return (E) this.c[i];
}
public String toString() {
if (b() <= 0) {
return "{}";
}
StringBuilder sb = new StringBuilder(this.d * 28);
sb.append('{');
for (int i = 0; i < this.d; i++) {
if (i > 0) {
sb.append(", ");
}
sb.append(d(i));
sb.append('=');
E f = f(i);
if (f != this) {
sb.append(f);
} else {
sb.append("(this Map)");
}
}
sb.append('}');
return sb.toString();
}
public SparseArrayCompat(int i) {
this.a = false;
if (i == 0) {
this.b = ContainerHelpers.a;
this.c = ContainerHelpers.c;
} else {
int b = ContainerHelpers.b(i);
this.b = new int[b];
this.c = new Object[b];
}
this.d = 0;
}
public E b(int i, E e2) {
int a = ContainerHelpers.a(this.b, this.d, i);
if (a >= 0) {
Object[] objArr = this.c;
if (objArr[a] != e) {
return (E) objArr[a];
}
}
return e2;
}
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
public SparseArrayCompat<E> m1clone() {
try {
SparseArrayCompat<E> sparseArrayCompat = (SparseArrayCompat) super.clone();
sparseArrayCompat.b = (int[]) this.b.clone();
sparseArrayCompat.c = (Object[]) this.c.clone();
return sparseArrayCompat;
} catch (CloneNotSupportedException e2) {
throw new AssertionError(e2);
}
}
public void a() {
int i = this.d;
Object[] objArr = this.c;
for (int i2 = 0; i2 < i; i2++) {
objArr[i2] = null;
}
this.d = 0;
this.a = false;
}
public int b() {
if (this.a) {
h();
}
return this.d;
}
public void a(int i, E e2) {
int i2 = this.d;
if (i2 != 0 && i <= this.b[i2 - 1]) {
c(i, e2);
return;
}
if (this.a && this.d >= this.b.length) {
h();
}
int i3 = this.d;
if (i3 >= this.b.length) {
int b = ContainerHelpers.b(i3 + 1);
int[] iArr = new int[b];
Object[] objArr = new Object[b];
int[] iArr2 = this.b;
System.arraycopy(iArr2, 0, iArr, 0, iArr2.length);
Object[] objArr2 = this.c;
System.arraycopy(objArr2, 0, objArr, 0, objArr2.length);
this.b = iArr;
this.c = objArr;
}
this.b[i3] = i;
this.c[i3] = e2;
this.d = i3 + 1;
}
public int c(int i) {
if (this.a) {
h();
}
return ContainerHelpers.a(this.b, this.d, i);
}
}