- Added realracing3-community.apk (71.57 MB) - Removed 32-bit support (armeabi-v7a) - Only includes arm64-v8a libraries - Decompiled source code included - Added README-community.md with analysis
336 lines
11 KiB
Java
336 lines
11 KiB
Java
package com.google.common.collect;
|
|
|
|
import com.google.common.collect.ImmutableCollection;
|
|
import com.ironsource.v8;
|
|
import java.io.Serializable;
|
|
import java.util.AbstractMap;
|
|
import java.util.Arrays;
|
|
import java.util.BitSet;
|
|
import java.util.Comparator;
|
|
import java.util.HashSet;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
|
|
/* loaded from: classes3.dex */
|
|
public abstract class ImmutableMap implements Map, Serializable {
|
|
public static final Map.Entry[] EMPTY_ENTRY_ARRAY = new Map.Entry[0];
|
|
public transient ImmutableSet entrySet;
|
|
public transient ImmutableSet keySet;
|
|
public transient ImmutableCollection values;
|
|
|
|
public abstract ImmutableSet createEntrySet();
|
|
|
|
public abstract ImmutableSet createKeySet();
|
|
|
|
public abstract ImmutableCollection createValues();
|
|
|
|
@Override // java.util.Map
|
|
public abstract Object get(Object obj);
|
|
|
|
public static ImmutableMap of() {
|
|
return RegularImmutableMap.EMPTY;
|
|
}
|
|
|
|
public static Builder builder() {
|
|
return new Builder();
|
|
}
|
|
|
|
public static class Builder {
|
|
public Object[] alternatingKeysAndValues;
|
|
public DuplicateKey duplicateKey;
|
|
public boolean entriesUsed;
|
|
public int size;
|
|
public Comparator valueComparator;
|
|
|
|
public Builder() {
|
|
this(4);
|
|
}
|
|
|
|
public Builder(int i) {
|
|
this.alternatingKeysAndValues = new Object[i * 2];
|
|
this.size = 0;
|
|
this.entriesUsed = false;
|
|
}
|
|
|
|
public final void ensureCapacity(int i) {
|
|
int i2 = i * 2;
|
|
Object[] objArr = this.alternatingKeysAndValues;
|
|
if (i2 > objArr.length) {
|
|
this.alternatingKeysAndValues = Arrays.copyOf(objArr, ImmutableCollection.Builder.expandedCapacity(objArr.length, i2));
|
|
this.entriesUsed = false;
|
|
}
|
|
}
|
|
|
|
public Builder put(Object obj, Object obj2) {
|
|
ensureCapacity(this.size + 1);
|
|
CollectPreconditions.checkEntryNotNull(obj, obj2);
|
|
Object[] objArr = this.alternatingKeysAndValues;
|
|
int i = this.size;
|
|
objArr[i * 2] = obj;
|
|
objArr[(i * 2) + 1] = obj2;
|
|
this.size = i + 1;
|
|
return this;
|
|
}
|
|
|
|
public final ImmutableMap build(boolean z) {
|
|
Object[] objArr;
|
|
DuplicateKey duplicateKey;
|
|
DuplicateKey duplicateKey2;
|
|
if (z && (duplicateKey2 = this.duplicateKey) != null) {
|
|
throw duplicateKey2.exception();
|
|
}
|
|
int i = this.size;
|
|
if (this.valueComparator == null) {
|
|
objArr = this.alternatingKeysAndValues;
|
|
} else {
|
|
if (this.entriesUsed) {
|
|
this.alternatingKeysAndValues = Arrays.copyOf(this.alternatingKeysAndValues, i * 2);
|
|
}
|
|
objArr = this.alternatingKeysAndValues;
|
|
if (!z) {
|
|
objArr = lastEntryForEachKey(objArr, this.size);
|
|
if (objArr.length < this.alternatingKeysAndValues.length) {
|
|
i = objArr.length >>> 1;
|
|
}
|
|
}
|
|
sortEntries(objArr, i, this.valueComparator);
|
|
}
|
|
this.entriesUsed = true;
|
|
RegularImmutableMap create = RegularImmutableMap.create(i, objArr, this);
|
|
if (!z || (duplicateKey = this.duplicateKey) == null) {
|
|
return create;
|
|
}
|
|
throw duplicateKey.exception();
|
|
}
|
|
|
|
public ImmutableMap buildOrThrow() {
|
|
return build(true);
|
|
}
|
|
|
|
public static void sortEntries(Object[] objArr, int i, Comparator comparator) {
|
|
Map.Entry[] entryArr = new Map.Entry[i];
|
|
for (int i2 = 0; i2 < i; i2++) {
|
|
int i3 = i2 * 2;
|
|
Object obj = objArr[i3];
|
|
Objects.requireNonNull(obj);
|
|
Object obj2 = objArr[i3 + 1];
|
|
Objects.requireNonNull(obj2);
|
|
entryArr[i2] = new AbstractMap.SimpleImmutableEntry(obj, obj2);
|
|
}
|
|
Arrays.sort(entryArr, 0, i, Ordering.from(comparator).onResultOf(Maps.valueFunction()));
|
|
for (int i4 = 0; i4 < i; i4++) {
|
|
int i5 = i4 * 2;
|
|
objArr[i5] = entryArr[i4].getKey();
|
|
objArr[i5 + 1] = entryArr[i4].getValue();
|
|
}
|
|
}
|
|
|
|
public final Object[] lastEntryForEachKey(Object[] objArr, int i) {
|
|
HashSet hashSet = new HashSet();
|
|
BitSet bitSet = new BitSet();
|
|
for (int i2 = i - 1; i2 >= 0; i2--) {
|
|
Object obj = objArr[i2 * 2];
|
|
Objects.requireNonNull(obj);
|
|
if (!hashSet.add(obj)) {
|
|
bitSet.set(i2);
|
|
}
|
|
}
|
|
if (bitSet.isEmpty()) {
|
|
return objArr;
|
|
}
|
|
Object[] objArr2 = new Object[(i - bitSet.cardinality()) * 2];
|
|
int i3 = 0;
|
|
int i4 = 0;
|
|
while (i3 < i * 2) {
|
|
if (bitSet.get(i3 >>> 1)) {
|
|
i3 += 2;
|
|
} else {
|
|
int i5 = i4 + 1;
|
|
int i6 = i3 + 1;
|
|
Object obj2 = objArr[i3];
|
|
Objects.requireNonNull(obj2);
|
|
objArr2[i4] = obj2;
|
|
i4 += 2;
|
|
i3 += 2;
|
|
Object obj3 = objArr[i6];
|
|
Objects.requireNonNull(obj3);
|
|
objArr2[i5] = obj3;
|
|
}
|
|
}
|
|
return objArr2;
|
|
}
|
|
|
|
public static final class DuplicateKey {
|
|
public final Object key;
|
|
public final Object value1;
|
|
public final Object value2;
|
|
|
|
public DuplicateKey(Object obj, Object obj2, Object obj3) {
|
|
this.key = obj;
|
|
this.value1 = obj2;
|
|
this.value2 = obj3;
|
|
}
|
|
|
|
public IllegalArgumentException exception() {
|
|
String valueOf = String.valueOf(this.key);
|
|
String valueOf2 = String.valueOf(this.value1);
|
|
String valueOf3 = String.valueOf(this.key);
|
|
String valueOf4 = String.valueOf(this.value2);
|
|
StringBuilder sb = new StringBuilder(valueOf.length() + 39 + valueOf2.length() + valueOf3.length() + valueOf4.length());
|
|
sb.append("Multiple entries with same key: ");
|
|
sb.append(valueOf);
|
|
sb.append(v8.i.b);
|
|
sb.append(valueOf2);
|
|
sb.append(" and ");
|
|
sb.append(valueOf3);
|
|
sb.append(v8.i.b);
|
|
sb.append(valueOf4);
|
|
return new IllegalArgumentException(sb.toString());
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public final Object put(Object obj, Object obj2) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public final Object remove(Object obj) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public final void putAll(Map map) {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public final void clear() {
|
|
throw new UnsupportedOperationException();
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean isEmpty() {
|
|
return size() == 0;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean containsKey(Object obj) {
|
|
return get(obj) != null;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean containsValue(Object obj) {
|
|
return values().contains(obj);
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public final Object getOrDefault(Object obj, Object obj2) {
|
|
Object obj3 = get(obj);
|
|
return obj3 != null ? obj3 : obj2;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public ImmutableSet entrySet() {
|
|
ImmutableSet immutableSet = this.entrySet;
|
|
if (immutableSet != null) {
|
|
return immutableSet;
|
|
}
|
|
ImmutableSet createEntrySet = createEntrySet();
|
|
this.entrySet = createEntrySet;
|
|
return createEntrySet;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public ImmutableSet keySet() {
|
|
ImmutableSet immutableSet = this.keySet;
|
|
if (immutableSet != null) {
|
|
return immutableSet;
|
|
}
|
|
ImmutableSet createKeySet = createKeySet();
|
|
this.keySet = createKeySet;
|
|
return createKeySet;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public ImmutableCollection values() {
|
|
ImmutableCollection immutableCollection = this.values;
|
|
if (immutableCollection != null) {
|
|
return immutableCollection;
|
|
}
|
|
ImmutableCollection createValues = createValues();
|
|
this.values = createValues;
|
|
return createValues;
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public boolean equals(Object obj) {
|
|
return Maps.equalsImpl(this, obj);
|
|
}
|
|
|
|
@Override // java.util.Map
|
|
public int hashCode() {
|
|
return Sets.hashCodeImpl(entrySet());
|
|
}
|
|
|
|
public String toString() {
|
|
return Maps.toStringImpl(this);
|
|
}
|
|
|
|
public static class SerializedForm implements Serializable {
|
|
private static final long serialVersionUID = 0;
|
|
public final Object keys;
|
|
public final Object values;
|
|
|
|
public SerializedForm(ImmutableMap immutableMap) {
|
|
Object[] objArr = new Object[immutableMap.size()];
|
|
Object[] objArr2 = new Object[immutableMap.size()];
|
|
UnmodifiableIterator it = immutableMap.entrySet().iterator();
|
|
int i = 0;
|
|
while (it.hasNext()) {
|
|
Map.Entry entry = (Map.Entry) it.next();
|
|
objArr[i] = entry.getKey();
|
|
objArr2[i] = entry.getValue();
|
|
i++;
|
|
}
|
|
this.keys = objArr;
|
|
this.values = objArr2;
|
|
}
|
|
|
|
public final Object readResolve() {
|
|
Object obj = this.keys;
|
|
if (!(obj instanceof ImmutableSet)) {
|
|
return legacyReadResolve();
|
|
}
|
|
ImmutableSet immutableSet = (ImmutableSet) obj;
|
|
ImmutableCollection immutableCollection = (ImmutableCollection) this.values;
|
|
Builder makeBuilder = makeBuilder(immutableSet.size());
|
|
UnmodifiableIterator it = immutableSet.iterator();
|
|
UnmodifiableIterator it2 = immutableCollection.iterator();
|
|
while (it.hasNext()) {
|
|
makeBuilder.put(it.next(), it2.next());
|
|
}
|
|
return makeBuilder.buildOrThrow();
|
|
}
|
|
|
|
public final Object legacyReadResolve() {
|
|
Object[] objArr = (Object[]) this.keys;
|
|
Object[] objArr2 = (Object[]) this.values;
|
|
Builder makeBuilder = makeBuilder(objArr.length);
|
|
for (int i = 0; i < objArr.length; i++) {
|
|
makeBuilder.put(objArr[i], objArr2[i]);
|
|
}
|
|
return makeBuilder.buildOrThrow();
|
|
}
|
|
|
|
public Builder makeBuilder(int i) {
|
|
return new Builder(i);
|
|
}
|
|
}
|
|
|
|
public Object writeReplace() {
|
|
return new SerializedForm(this);
|
|
}
|
|
}
|