package com.applovin.impl; import com.applovin.impl.cb; import java.io.Serializable; import java.util.AbstractMap; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.Iterator; import java.util.Map; import java.util.SortedMap; /* loaded from: classes.dex */ public abstract class gb implements Map, Serializable { static final Map.Entry[] d = new Map.Entry[0]; private transient ib a; private transient ib b; private transient cb c; public static gb h() { return ni.i; } public abstract ib b(); public abstract ib c(); @Override // java.util.Map public final void clear() { throw new UnsupportedOperationException(); } public abstract cb d(); public abstract boolean f(); @Override // java.util.Map public abstract Object get(Object obj); @Override // java.util.Map public final Object put(Object obj, Object obj2) { throw new UnsupportedOperationException(); } @Override // java.util.Map public final void putAll(Map map) { throw new UnsupportedOperationException(); } @Override // java.util.Map public final Object remove(Object obj) { throw new UnsupportedOperationException(); } public static class a { Comparator a; Object[] b; int c; boolean d; public a() { this(4); } public gb a() { b(); this.d = true; return ni.a(this.c, this.b); } public void b() { int i; if (this.a != null) { if (this.d) { this.b = Arrays.copyOf(this.b, this.c * 2); } Map.Entry[] entryArr = new Map.Entry[this.c]; int i2 = 0; while (true) { i = this.c; if (i2 >= i) { break; } Object[] objArr = this.b; int i3 = i2 * 2; entryArr[i2] = new AbstractMap.SimpleImmutableEntry(objArr[i3], objArr[i3 + 1]); i2++; } Arrays.sort(entryArr, 0, i, wg.a(this.a).a(vc.c())); for (int i4 = 0; i4 < this.c; i4++) { int i5 = i4 * 2; this.b[i5] = entryArr[i4].getKey(); this.b[i5 + 1] = entryArr[i4].getValue(); } } } public a(int i) { this.b = new Object[i * 2]; this.c = 0; this.d = false; } private void a(int i) { int i2 = i * 2; Object[] objArr = this.b; if (i2 > objArr.length) { this.b = Arrays.copyOf(objArr, cb.b.a(objArr.length, i2)); this.d = false; } } public a a(Object obj, Object obj2) { a(this.c + 1); p3.a(obj, obj2); Object[] objArr = this.b; int i = this.c; int i2 = i * 2; objArr[i2] = obj; objArr[i2 + 1] = obj2; this.c = i + 1; return this; } public a a(Map.Entry entry) { return a(entry.getKey(), entry.getValue()); } public a a(Iterable iterable) { if (iterable instanceof Collection) { a(this.c + ((Collection) iterable).size()); } Iterator it = iterable.iterator(); while (it.hasNext()) { a((Map.Entry) it.next()); } return this; } } public static gb a(Iterable iterable) { a aVar = new a(iterable instanceof Collection ? ((Collection) iterable).size() : 4); aVar.a(iterable); return aVar.a(); } @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 /* renamed from: e, reason: merged with bridge method [inline-methods] */ public ib entrySet() { ib ibVar = this.a; if (ibVar != null) { return ibVar; } ib b = b(); this.a = b; return b; } @Override // java.util.Map /* renamed from: g, reason: merged with bridge method [inline-methods] */ public ib keySet() { ib ibVar = this.b; if (ibVar != null) { return ibVar; } ib c = c(); this.b = c; return c; } @Override // java.util.Map /* renamed from: i, reason: merged with bridge method [inline-methods] */ public cb values() { cb cbVar = this.c; if (cbVar != null) { return cbVar; } cb d2 = d(); this.c = d2; return d2; } @Override // java.util.Map public boolean equals(Object obj) { return vc.a((Map) this, obj); } @Override // java.util.Map public int hashCode() { return rj.a(entrySet()); } public String toString() { return vc.a(this); } public static gb a(Map map) { if ((map instanceof gb) && !(map instanceof SortedMap)) { gb gbVar = (gb) map; if (!gbVar.f()) { return gbVar; } } return a(map.entrySet()); } public static a a() { return new a(); } }