252 lines
6.8 KiB
Java
252 lines
6.8 KiB
Java
|
package ra;
|
||
|
|
||
|
import java.io.Serializable;
|
||
|
import java.util.AbstractMap;
|
||
|
import java.util.Arrays;
|
||
|
import java.util.Collection;
|
||
|
import java.util.Comparator;
|
||
|
import java.util.Map;
|
||
|
import java.util.SortedMap;
|
||
|
import ra.q;
|
||
|
/* compiled from: ImmutableMap.java */
|
||
|
/* loaded from: classes4.dex */
|
||
|
public abstract class u<K, V> implements Map<K, V>, Serializable {
|
||
|
|
||
|
/* renamed from: m reason: collision with root package name */
|
||
|
static final Map.Entry<?, ?>[] f21776m = new Map.Entry[0];
|
||
|
|
||
|
/* renamed from: j reason: collision with root package name */
|
||
|
private transient w<Map.Entry<K, V>> f21777j;
|
||
|
|
||
|
/* renamed from: k reason: collision with root package name */
|
||
|
private transient w<K> f21778k;
|
||
|
|
||
|
/* renamed from: l reason: collision with root package name */
|
||
|
private transient q<V> f21779l;
|
||
|
|
||
|
/* compiled from: ImmutableMap.java */
|
||
|
/* loaded from: classes4.dex */
|
||
|
public static class a<K, V> {
|
||
|
|
||
|
/* renamed from: a reason: collision with root package name */
|
||
|
Comparator<? super V> f21780a;
|
||
|
|
||
|
/* renamed from: b reason: collision with root package name */
|
||
|
Object[] f21781b;
|
||
|
|
||
|
/* renamed from: c reason: collision with root package name */
|
||
|
int f21782c;
|
||
|
|
||
|
/* renamed from: d reason: collision with root package name */
|
||
|
boolean f21783d;
|
||
|
|
||
|
public a() {
|
||
|
this(4);
|
||
|
}
|
||
|
|
||
|
a(int i10) {
|
||
|
this.f21781b = new Object[i10 * 2];
|
||
|
this.f21782c = 0;
|
||
|
this.f21783d = false;
|
||
|
}
|
||
|
|
||
|
private void b(int i10) {
|
||
|
int i11 = i10 * 2;
|
||
|
Object[] objArr = this.f21781b;
|
||
|
if (i11 > objArr.length) {
|
||
|
this.f21781b = Arrays.copyOf(objArr, q.b.a(objArr.length, i11));
|
||
|
this.f21783d = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public u<K, V> a() {
|
||
|
f();
|
||
|
this.f21783d = true;
|
||
|
return m0.m(this.f21782c, this.f21781b);
|
||
|
}
|
||
|
|
||
|
public a<K, V> c(K k2, V v10) {
|
||
|
b(this.f21782c + 1);
|
||
|
i.a(k2, v10);
|
||
|
Object[] objArr = this.f21781b;
|
||
|
int i10 = this.f21782c;
|
||
|
objArr[i10 * 2] = k2;
|
||
|
objArr[(i10 * 2) + 1] = v10;
|
||
|
this.f21782c = i10 + 1;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
/* JADX WARN: Multi-variable type inference failed */
|
||
|
public a<K, V> d(Map.Entry<? extends K, ? extends V> entry) {
|
||
|
return c(entry.getKey(), entry.getValue());
|
||
|
}
|
||
|
|
||
|
public a<K, V> e(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
|
||
|
if (iterable instanceof Collection) {
|
||
|
b(this.f21782c + ((Collection) iterable).size());
|
||
|
}
|
||
|
for (Map.Entry<? extends K, ? extends V> entry : iterable) {
|
||
|
d(entry);
|
||
|
}
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
void f() {
|
||
|
int i10;
|
||
|
if (this.f21780a != null) {
|
||
|
if (this.f21783d) {
|
||
|
this.f21781b = Arrays.copyOf(this.f21781b, this.f21782c * 2);
|
||
|
}
|
||
|
Map.Entry[] entryArr = new Map.Entry[this.f21782c];
|
||
|
int i11 = 0;
|
||
|
while (true) {
|
||
|
i10 = this.f21782c;
|
||
|
if (i11 >= i10) {
|
||
|
break;
|
||
|
}
|
||
|
Object[] objArr = this.f21781b;
|
||
|
int i12 = i11 * 2;
|
||
|
entryArr[i11] = new AbstractMap.SimpleImmutableEntry(objArr[i12], objArr[i12 + 1]);
|
||
|
i11++;
|
||
|
}
|
||
|
Arrays.sort(entryArr, 0, i10, j0.b(this.f21780a).k(c0.j()));
|
||
|
for (int i13 = 0; i13 < this.f21782c; i13++) {
|
||
|
int i14 = i13 * 2;
|
||
|
this.f21781b[i14] = entryArr[i13].getKey();
|
||
|
this.f21781b[i14 + 1] = entryArr[i13].getValue();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
u() {
|
||
|
}
|
||
|
|
||
|
public static <K, V> a<K, V> a() {
|
||
|
return new a<>();
|
||
|
}
|
||
|
|
||
|
public static <K, V> u<K, V> b(Iterable<? extends Map.Entry<? extends K, ? extends V>> iterable) {
|
||
|
a aVar = new a(iterable instanceof Collection ? ((Collection) iterable).size() : 4);
|
||
|
aVar.e(iterable);
|
||
|
return aVar.a();
|
||
|
}
|
||
|
|
||
|
public static <K, V> u<K, V> c(Map<? extends K, ? extends V> map) {
|
||
|
if ((map instanceof u) && !(map instanceof SortedMap)) {
|
||
|
u<K, V> uVar = (u) map;
|
||
|
if (!uVar.i()) {
|
||
|
return uVar;
|
||
|
}
|
||
|
}
|
||
|
return b(map.entrySet());
|
||
|
}
|
||
|
|
||
|
public static <K, V> u<K, V> k() {
|
||
|
return (u<K, V>) m0.f21731q;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
@Deprecated
|
||
|
public final void clear() {
|
||
|
throw new UnsupportedOperationException();
|
||
|
}
|
||
|
|
||
|
@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);
|
||
|
}
|
||
|
|
||
|
abstract w<Map.Entry<K, V>> d();
|
||
|
|
||
|
abstract w<K> e();
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
public boolean equals(Object obj) {
|
||
|
return c0.b(this, obj);
|
||
|
}
|
||
|
|
||
|
abstract q<V> f();
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
public abstract V get(Object obj);
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
public final V getOrDefault(Object obj, V v10) {
|
||
|
V v11 = get(obj);
|
||
|
return v11 != null ? v11 : v10;
|
||
|
}
|
||
|
|
||
|
/* renamed from: h */
|
||
|
public w<Map.Entry<K, V>> entrySet() {
|
||
|
w<Map.Entry<K, V>> wVar = this.f21777j;
|
||
|
if (wVar != null) {
|
||
|
return wVar;
|
||
|
}
|
||
|
w<Map.Entry<K, V>> d10 = d();
|
||
|
this.f21777j = d10;
|
||
|
return d10;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
public int hashCode() {
|
||
|
return r0.b(entrySet());
|
||
|
}
|
||
|
|
||
|
abstract boolean i();
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
public boolean isEmpty() {
|
||
|
return size() == 0;
|
||
|
}
|
||
|
|
||
|
/* renamed from: j */
|
||
|
public w<K> keySet() {
|
||
|
w<K> wVar = this.f21778k;
|
||
|
if (wVar != null) {
|
||
|
return wVar;
|
||
|
}
|
||
|
w<K> e10 = e();
|
||
|
this.f21778k = e10;
|
||
|
return e10;
|
||
|
}
|
||
|
|
||
|
/* renamed from: l */
|
||
|
public q<V> values() {
|
||
|
q<V> qVar = this.f21779l;
|
||
|
if (qVar != null) {
|
||
|
return qVar;
|
||
|
}
|
||
|
q<V> f2 = f();
|
||
|
this.f21779l = f2;
|
||
|
return f2;
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
@Deprecated
|
||
|
public final V put(K k2, V v10) {
|
||
|
throw new UnsupportedOperationException();
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
@Deprecated
|
||
|
public final void putAll(Map<? extends K, ? extends V> map) {
|
||
|
throw new UnsupportedOperationException();
|
||
|
}
|
||
|
|
||
|
@Override // java.util.Map
|
||
|
@Deprecated
|
||
|
public final V remove(Object obj) {
|
||
|
throw new UnsupportedOperationException();
|
||
|
}
|
||
|
|
||
|
public String toString() {
|
||
|
return c0.i(this);
|
||
|
}
|
||
|
}
|