291 lines
9.7 KiB
Java
291 lines
9.7 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.base.Preconditions;
|
|
import java.util.AbstractMap;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
final class RegularImmutableMap<K, V> extends ImmutableMap<K, V> {
|
|
static final ImmutableMap<Object, Object> d = new RegularImmutableMap(null, new Object[0], 0);
|
|
private final transient int[] a;
|
|
private final transient Object[] b;
|
|
private final transient int c;
|
|
|
|
static class EntrySet<K, V> extends ImmutableSet<Map.Entry<K, V>> {
|
|
private final transient ImmutableMap<K, V> a;
|
|
private final transient Object[] b;
|
|
private final transient int c;
|
|
private final transient int d;
|
|
|
|
EntrySet(ImmutableMap<K, V> immutableMap, Object[] objArr, int i, int i2) {
|
|
this.a = immutableMap;
|
|
this.b = objArr;
|
|
this.c = i;
|
|
this.d = i2;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
if (!(obj instanceof Map.Entry)) {
|
|
return false;
|
|
}
|
|
Map.Entry entry = (Map.Entry) obj;
|
|
Object key = entry.getKey();
|
|
Object value = entry.getValue();
|
|
return value != null && value.equals(this.a.get(key));
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet
|
|
ImmutableList<Map.Entry<K, V>> createAsList() {
|
|
return new ImmutableList<Map.Entry<K, V>>() { // from class: com.google.common.collect.RegularImmutableMap.EntrySet.1
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
public boolean isPartialView() {
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public int size() {
|
|
return EntrySet.this.d;
|
|
}
|
|
|
|
@Override // java.util.List
|
|
public Map.Entry<K, V> get(int i) {
|
|
Preconditions.a(i, EntrySet.this.d);
|
|
int i2 = i * 2;
|
|
return new AbstractMap.SimpleImmutableEntry(EntrySet.this.b[EntrySet.this.c + i2], EntrySet.this.b[i2 + (EntrySet.this.c ^ 1)]);
|
|
}
|
|
};
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
boolean isPartialView() {
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return this.d;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
|
|
public UnmodifiableIterator<Map.Entry<K, V>> iterator() {
|
|
return asList().iterator();
|
|
}
|
|
}
|
|
|
|
static final class KeySet<K> extends ImmutableSet<K> {
|
|
private final transient ImmutableMap<K, ?> a;
|
|
private final transient ImmutableList<K> b;
|
|
|
|
KeySet(ImmutableMap<K, ?> immutableMap, ImmutableList<K> immutableList) {
|
|
this.a = immutableMap;
|
|
this.b = immutableList;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection
|
|
public ImmutableList<K> asList() {
|
|
return this.b;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public boolean contains(Object obj) {
|
|
return this.a.get(obj) != null;
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
boolean isPartialView() {
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.Set
|
|
public int size() {
|
|
return this.a.size();
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableSet, com.google.common.collect.ImmutableCollection, java.util.AbstractCollection, java.util.Collection, java.lang.Iterable, java.util.Set, java.util.NavigableSet
|
|
public UnmodifiableIterator<K> iterator() {
|
|
return asList().iterator();
|
|
}
|
|
}
|
|
|
|
static final class KeysOrValuesAsList extends ImmutableList<Object> {
|
|
private final transient Object[] a;
|
|
private final transient int b;
|
|
private final transient int c;
|
|
|
|
KeysOrValuesAsList(Object[] objArr, int i, int i2) {
|
|
this.a = objArr;
|
|
this.b = i;
|
|
this.c = i2;
|
|
}
|
|
|
|
@Override // java.util.List
|
|
public Object get(int i) {
|
|
Preconditions.a(i, this.c);
|
|
return this.a[(i * 2) + this.b];
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableCollection
|
|
boolean isPartialView() {
|
|
return true;
|
|
}
|
|
|
|
@Override // java.util.AbstractCollection, java.util.Collection, java.util.List
|
|
public int size() {
|
|
return this.c;
|
|
}
|
|
}
|
|
|
|
private RegularImmutableMap(int[] iArr, Object[] objArr, int i) {
|
|
this.a = iArr;
|
|
this.b = objArr;
|
|
this.c = i;
|
|
}
|
|
|
|
static <K, V> RegularImmutableMap<K, V> a(int i, Object[] objArr) {
|
|
if (i == 0) {
|
|
return (RegularImmutableMap) d;
|
|
}
|
|
if (i == 1) {
|
|
CollectPreconditions.a(objArr[0], objArr[1]);
|
|
return new RegularImmutableMap<>(null, objArr, 1);
|
|
}
|
|
Preconditions.b(i, objArr.length >> 1);
|
|
return new RegularImmutableMap<>(a(objArr, i, ImmutableSet.chooseTableSize(i), 0), objArr, i);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableMap
|
|
ImmutableSet<Map.Entry<K, V>> createEntrySet() {
|
|
return new EntrySet(this, this.b, 0, this.c);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableMap
|
|
ImmutableSet<K> createKeySet() {
|
|
return new KeySet(this, new KeysOrValuesAsList(this.b, 0, this.c));
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableMap
|
|
ImmutableCollection<V> createValues() {
|
|
return new KeysOrValuesAsList(this.b, 1, this.c);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableMap, java.util.Map
|
|
public V get(Object obj) {
|
|
return (V) a(this.a, this.b, this.c, 0, obj);
|
|
}
|
|
|
|
@Override // com.google.common.collect.ImmutableMap
|
|
boolean isPartialView() {
|
|
return false;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public int size() {
|
|
return this.c;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:18:0x0034, code lost:
|
|
|
|
r12[r7] = r5;
|
|
r3 = r3 + 1;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
|
*/
|
|
static int[] a(java.lang.Object[] r10, int r11, int r12, int r13) {
|
|
/*
|
|
r0 = 1
|
|
if (r11 != r0) goto Le
|
|
r11 = r10[r13]
|
|
r12 = r13 ^ 1
|
|
r10 = r10[r12]
|
|
com.google.common.collect.CollectPreconditions.a(r11, r10)
|
|
r10 = 0
|
|
return r10
|
|
Le:
|
|
int r1 = r12 + (-1)
|
|
int[] r12 = new int[r12]
|
|
r2 = -1
|
|
java.util.Arrays.fill(r12, r2)
|
|
r3 = 0
|
|
L17:
|
|
if (r3 >= r11) goto L77
|
|
int r4 = r3 * 2
|
|
int r5 = r4 + r13
|
|
r6 = r10[r5]
|
|
r7 = r13 ^ 1
|
|
int r4 = r4 + r7
|
|
r4 = r10[r4]
|
|
com.google.common.collect.CollectPreconditions.a(r6, r4)
|
|
int r7 = r6.hashCode()
|
|
int r7 = com.google.common.collect.Hashing.a(r7)
|
|
L2f:
|
|
r7 = r7 & r1
|
|
r8 = r12[r7]
|
|
if (r8 != r2) goto L39
|
|
r12[r7] = r5
|
|
int r3 = r3 + 1
|
|
goto L17
|
|
L39:
|
|
r9 = r10[r8]
|
|
boolean r9 = r9.equals(r6)
|
|
if (r9 != 0) goto L44
|
|
int r7 = r7 + 1
|
|
goto L2f
|
|
L44:
|
|
java.lang.IllegalArgumentException r11 = new java.lang.IllegalArgumentException
|
|
java.lang.StringBuilder r12 = new java.lang.StringBuilder
|
|
r12.<init>()
|
|
java.lang.String r13 = "Multiple entries with same key: "
|
|
r12.append(r13)
|
|
r12.append(r6)
|
|
java.lang.String r13 = "="
|
|
r12.append(r13)
|
|
r12.append(r4)
|
|
java.lang.String r1 = " and "
|
|
r12.append(r1)
|
|
r1 = r10[r8]
|
|
r12.append(r1)
|
|
r12.append(r13)
|
|
r13 = r8 ^ 1
|
|
r10 = r10[r13]
|
|
r12.append(r10)
|
|
java.lang.String r10 = r12.toString()
|
|
r11.<init>(r10)
|
|
throw r11
|
|
L77:
|
|
return r12
|
|
*/
|
|
throw new UnsupportedOperationException("Method not decompiled: com.google.common.collect.RegularImmutableMap.a(java.lang.Object[], int, int, int):int[]");
|
|
}
|
|
|
|
static Object a(int[] iArr, Object[] objArr, int i, int i2, Object obj) {
|
|
if (obj == null) {
|
|
return null;
|
|
}
|
|
if (i == 1) {
|
|
if (objArr[i2].equals(obj)) {
|
|
return objArr[i2 ^ 1];
|
|
}
|
|
return null;
|
|
}
|
|
if (iArr == null) {
|
|
return null;
|
|
}
|
|
int length = iArr.length - 1;
|
|
int a = Hashing.a(obj.hashCode());
|
|
while (true) {
|
|
int i3 = a & length;
|
|
int i4 = iArr[i3];
|
|
if (i4 == -1) {
|
|
return null;
|
|
}
|
|
if (objArr[i4].equals(obj)) {
|
|
return objArr[i4 ^ 1];
|
|
}
|
|
a = i3 + 1;
|
|
}
|
|
}
|
|
}
|