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 implements Map, 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> f21777j; /* renamed from: k reason: collision with root package name */ private transient w f21778k; /* renamed from: l reason: collision with root package name */ private transient q f21779l; /* compiled from: ImmutableMap.java */ /* loaded from: classes4.dex */ public static class a { /* renamed from: a reason: collision with root package name */ Comparator 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 a() { f(); this.f21783d = true; return m0.m(this.f21782c, this.f21781b); } public a 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 d(Map.Entry entry) { return c(entry.getKey(), entry.getValue()); } public a e(Iterable> iterable) { if (iterable instanceof Collection) { b(this.f21782c + ((Collection) iterable).size()); } for (Map.Entry 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 a a() { return new a<>(); } public static u b(Iterable> iterable) { a aVar = new a(iterable instanceof Collection ? ((Collection) iterable).size() : 4); aVar.e(iterable); return aVar.a(); } public static u c(Map map) { if ((map instanceof u) && !(map instanceof SortedMap)) { u uVar = (u) map; if (!uVar.i()) { return uVar; } } return b(map.entrySet()); } public static u k() { return (u) 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> d(); abstract w e(); @Override // java.util.Map public boolean equals(Object obj) { return c0.b(this, obj); } abstract q 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> entrySet() { w> wVar = this.f21777j; if (wVar != null) { return wVar; } w> 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 keySet() { w wVar = this.f21778k; if (wVar != null) { return wVar; } w e10 = e(); this.f21778k = e10; return e10; } /* renamed from: l */ public q values() { q qVar = this.f21779l; if (qVar != null) { return qVar; } q 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 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); } }