package ra; import com.facebook.react.uimanager.ViewDefaults; import java.util.AbstractCollection; import java.util.AbstractMap; import java.util.Collection; import java.util.HashSet; import java.util.IdentityHashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import qa.g; import qa.h; import ra.r0; /* compiled from: Maps.java */ /* loaded from: classes4.dex */ public final class c0 { /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static class a extends t0, V> { a(Iterator it) { super(it); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: c */ public V b(Map.Entry entry) { return entry.getValue(); } } /* JADX WARN: Failed to restore enum class, 'enum' modifier removed */ /* compiled from: Maps.java */ /* loaded from: classes4.dex */ private static abstract class b extends Enum implements qa.f, Object> { /* renamed from: j reason: collision with root package name */ public static final b f21647j; /* renamed from: k reason: collision with root package name */ public static final b f21648k; /* renamed from: l reason: collision with root package name */ private static final /* synthetic */ b[] f21649l; /* JADX WARN: Failed to restore enum class, 'enum' modifier removed */ /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static class a extends b { a(String str, int i10) { super(str, i10, null); } /* renamed from: a */ public Object apply(Map.Entry entry) { return entry.getKey(); } } /* JADX WARN: Failed to restore enum class, 'enum' modifier removed */ /* compiled from: Maps.java */ /* renamed from: ra.c0$b$b reason: collision with other inner class name */ /* loaded from: classes4.dex */ static class C0376b extends b { C0376b(String str, int i10) { super(str, i10, null); } /* renamed from: a */ public Object apply(Map.Entry entry) { return entry.getValue(); } } static { a aVar = new a("KEY", 0); f21647j = aVar; C0376b bVar = new C0376b("VALUE", 1); f21648k = bVar; f21649l = new b[]{aVar, bVar}; } private b(String str, int i10) { } /* synthetic */ b(String str, int i10, b0 b0Var) { this(str, i10); } public static b valueOf(String str) { return (b) Enum.valueOf(b.class, str); } public static b[] values() { return (b[]) f21649l.clone(); } } /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static abstract class c extends r0.b> { c() { } abstract Map a(); @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public void clear() { a().clear(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public abstract boolean contains(Object obj); @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean isEmpty() { return a().isEmpty(); } @Override // ra.r0.b, java.util.AbstractSet, java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean removeAll(Collection collection) { try { return super.removeAll((Collection) h.j(collection)); } catch (UnsupportedOperationException unused) { return r0.h(this, collection.iterator()); } } @Override // ra.r0.b, java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean retainAll(Collection collection) { try { return super.retainAll((Collection) h.j(collection)); } catch (UnsupportedOperationException unused) { HashSet e10 = r0.e(collection.size()); for (Object obj : collection) { if (contains(obj)) { e10.add(((Map.Entry) obj).getKey()); } } return a().keySet().retainAll(e10); } } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public int size() { return a().size(); } } /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static class d extends r0.b { /* renamed from: j reason: collision with root package name */ final Map f21650j; d(Map map) { this.f21650j = (Map) h.j(map); } Map a() { return this.f21650j; } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean contains(Object obj) { return a().containsKey(obj); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public boolean isEmpty() { return a().isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.util.Set public int size() { return a().size(); } } /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static class e extends AbstractCollection { /* renamed from: j reason: collision with root package name */ final Map f21651j; e(Map map) { this.f21651j = (Map) h.j(map); } final Map a() { return this.f21651j; } @Override // java.util.AbstractCollection, java.util.Collection public void clear() { a().clear(); } @Override // java.util.AbstractCollection, java.util.Collection public boolean contains(Object obj) { return a().containsValue(obj); } @Override // java.util.AbstractCollection, java.util.Collection public boolean isEmpty() { return a().isEmpty(); } @Override // java.util.AbstractCollection, java.util.Collection, java.lang.Iterable public Iterator iterator() { return c0.k(a().entrySet().iterator()); } @Override // java.util.AbstractCollection, java.util.Collection public boolean remove(Object obj) { try { return super.remove(obj); } catch (UnsupportedOperationException unused) { for (Map.Entry entry : a().entrySet()) { if (g.a(obj, entry.getValue())) { a().remove(entry.getKey()); return true; } } return false; } } @Override // java.util.AbstractCollection, java.util.Collection public boolean removeAll(Collection collection) { try { return super.removeAll((Collection) h.j(collection)); } catch (UnsupportedOperationException unused) { HashSet d10 = r0.d(); for (Map.Entry entry : a().entrySet()) { if (collection.contains(entry.getValue())) { d10.add(entry.getKey()); } } return a().keySet().removeAll(d10); } } @Override // java.util.AbstractCollection, java.util.Collection public boolean retainAll(Collection collection) { try { return super.retainAll((Collection) h.j(collection)); } catch (UnsupportedOperationException unused) { HashSet d10 = r0.d(); for (Map.Entry entry : a().entrySet()) { if (collection.contains(entry.getValue())) { d10.add(entry.getKey()); } } return a().keySet().retainAll(d10); } } @Override // java.util.AbstractCollection, java.util.Collection public int size() { return a().size(); } } /* compiled from: Maps.java */ /* loaded from: classes4.dex */ static abstract class f extends AbstractMap { /* renamed from: j reason: collision with root package name */ private transient Set> f21652j; /* renamed from: k reason: collision with root package name */ private transient Collection f21653k; f() { } abstract Set> a(); Collection b() { return new e(this); } @Override // java.util.AbstractMap, java.util.Map public Set> entrySet() { Set> set = this.f21652j; if (set != null) { return set; } Set> a10 = a(); this.f21652j = a10; return a10; } @Override // java.util.AbstractMap, java.util.Map public Collection values() { Collection collection = this.f21653k; if (collection != null) { return collection; } Collection b10 = b(); this.f21653k = b10; return b10; } } static int a(int i10) { if (i10 >= 3) { return i10 < 1073741824 ? (int) ((i10 / 0.75f) + 1.0f) : ViewDefaults.NUMBER_OF_LINES; } i.b(i10, "expectedSize"); return i10 + 1; } static boolean b(Map map, Object obj) { if (map == obj) { return true; } if (obj instanceof Map) { return map.entrySet().equals(((Map) obj).entrySet()); } return false; } public static Map.Entry c(K k2, V v10) { return new r(k2, v10); } static qa.f, K> d() { return b.f21647j; } public static IdentityHashMap e() { return new IdentityHashMap<>(); } static boolean f(Map map, Object obj) { h.j(map); try { return map.containsKey(obj); } catch (ClassCastException | NullPointerException unused) { return false; } } static V g(Map map, Object obj) { h.j(map); try { return map.get(obj); } catch (ClassCastException | NullPointerException unused) { return null; } } static V h(Map map, Object obj) { h.j(map); try { return map.remove(obj); } catch (ClassCastException | NullPointerException unused) { return null; } } static String i(Map map) { StringBuilder a10 = j.a(map.size()); a10.append('{'); boolean z10 = true; for (Map.Entry entry : map.entrySet()) { if (!z10) { a10.append(", "); } z10 = false; a10.append(entry.getKey()); a10.append('='); a10.append(entry.getValue()); } a10.append('}'); return a10.toString(); } static qa.f, V> j() { return b.f21648k; } static Iterator k(Iterator> it) { return new a(it); } }