package o; import com.huawei.hms.framework.common.ContainerUtils; import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.Map; import java.util.NoSuchElementException; import java.util.Set; /* loaded from: classes.dex */ public abstract class qXr { qXr.LWm a; qXr.Sts b; qXr.IeS c; protected abstract int a(Object obj); protected abstract void a(); protected abstract void a(int i); protected abstract int b(Object obj); protected abstract Map b(); protected abstract void b(K k, V v); protected abstract V c(int i, V v); protected abstract int e(); protected abstract Object e(int i, int i2); /* loaded from: classes.dex */ final class HBt implements Iterator { private boolean a = false; final qXr b; final int c; private int d; private int e; HBt(qXr qxr, int i) { this.b = qxr; this.c = i; this.d = qxr.e(); } @Override // java.util.Iterator public final T next() { if (!hasNext()) { throw new NoSuchElementException(); } T t = (T) this.b.e(this.e, this.c); this.e++; this.a = true; return t; } @Override // java.util.Iterator public final void remove() { if (!this.a) { throw new IllegalStateException(); } int i = this.e - 1; this.e = i; this.d--; this.a = false; this.b.a(i); } @Override // java.util.Iterator public final boolean hasNext() { return this.e < this.d; } } /* loaded from: classes.dex */ final class RVV implements Iterator>, Map.Entry { final qXr b; private int d; private boolean a = false; private int e = -1; RVV(qXr qxr) { this.b = qxr; this.d = qxr.e() - 1; } @Override // java.util.Iterator public final void remove() { if (!this.a) { throw new IllegalStateException(); } this.b.a(this.e); this.e--; this.d--; this.a = false; } @Override // java.util.Map.Entry public final K getKey() { if (!this.a) { throw new IllegalStateException("This container does not support retaining Map.Entry objects"); } return (K) this.b.e(this.e, 0); } @Override // java.util.Map.Entry public final V getValue() { if (!this.a) { throw new IllegalStateException("This container does not support retaining Map.Entry objects"); } return (V) this.b.e(this.e, 1); } @Override // java.util.Map.Entry public final V setValue(V v) { if (!this.a) { throw new IllegalStateException("This container does not support retaining Map.Entry objects"); } return (V) this.b.c(this.e, v); } @Override // java.util.Map.Entry public final boolean equals(Object obj) { if (!this.a) { throw new IllegalStateException("This container does not support retaining Map.Entry objects"); } if (!(obj instanceof Map.Entry)) { return false; } Map.Entry entry = (Map.Entry) obj; return C6569cWs.e(entry.getKey(), this.b.e(this.e, 0)) && C6569cWs.e(entry.getValue(), this.b.e(this.e, 1)); } @Override // java.util.Map.Entry public final int hashCode() { if (!this.a) { throw new IllegalStateException("This container does not support retaining Map.Entry objects"); } Object e = this.b.e(this.e, 0); Object e2 = this.b.e(this.e, 1); return (e == null ? 0 : e.hashCode()) ^ (e2 != null ? e2.hashCode() : 0); } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(getKey()); sb.append(ContainerUtils.KEY_VALUE_DELIMITER); sb.append(getValue()); return sb.toString(); } @Override // java.util.Iterator public final /* synthetic */ Object next() { if (!hasNext()) { throw new NoSuchElementException(); } this.e++; this.a = true; return this; } @Override // java.util.Iterator public final boolean hasNext() { return this.e < this.d; } } /* loaded from: classes.dex */ final class IeS implements Set> { final qXr e; /* JADX INFO: Access modifiers changed from: package-private */ public IeS(qXr qxr) { this.e = qxr; } @Override // java.util.Set, java.util.Collection public final /* synthetic */ boolean add(Object obj) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final boolean addAll(Collection> collection) { int e = this.e.e(); for (Map.Entry entry : collection) { this.e.b(entry.getKey(), entry.getValue()); } return e != this.e.e(); } @Override // java.util.Set, java.util.Collection public final void clear() { this.e.a(); } @Override // java.util.Set, java.util.Collection public final boolean contains(Object obj) { if (!(obj instanceof Map.Entry)) { return false; } Map.Entry entry = (Map.Entry) obj; int b = this.e.b(entry.getKey()); if (b < 0) { return false; } return C6569cWs.e(this.e.e(b, 1), entry.getValue()); } @Override // java.util.Set, java.util.Collection public final boolean containsAll(Collection collection) { Iterator it = collection.iterator(); while (it.hasNext()) { if (!contains(it.next())) { return false; } } return true; } @Override // java.util.Set, java.util.Collection public final boolean isEmpty() { return this.e.e() == 0; } @Override // java.util.Set, java.util.Collection, java.lang.Iterable public final Iterator> iterator() { return new RVV(this.e); } @Override // java.util.Set, java.util.Collection public final boolean remove(Object obj) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final boolean removeAll(Collection collection) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final boolean retainAll(Collection collection) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final int size() { return this.e.e(); } @Override // java.util.Set, java.util.Collection public final Object[] toArray() { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final T[] toArray(T[] tArr) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final boolean equals(Object obj) { return qXr.a(this, obj); } @Override // java.util.Set, java.util.Collection public final int hashCode() { int i = 0; for (int e = this.e.e() - 1; e >= 0; e--) { Object e2 = this.e.e(e, 0); Object e3 = this.e.e(e, 1); i += (e2 == null ? 0 : e2.hashCode()) ^ (e3 == null ? 0 : e3.hashCode()); } return i; } } /* loaded from: classes.dex */ final class LWm implements Set { final qXr d; /* JADX INFO: Access modifiers changed from: package-private */ public LWm(qXr qxr) { this.d = qxr; } @Override // java.util.Set, java.util.Collection public final boolean add(K k) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final boolean addAll(Collection collection) { throw new UnsupportedOperationException(); } @Override // java.util.Set, java.util.Collection public final void clear() { this.d.a(); } @Override // java.util.Set, java.util.Collection public final boolean contains(Object obj) { return this.d.b(obj) >= 0; } @Override // java.util.Set, java.util.Collection public final boolean containsAll(Collection collection) { Map b = this.d.b(); Iterator it = collection.iterator(); while (it.hasNext()) { if (!b.containsKey(it.next())) { return false; } } return true; } @Override // java.util.Set, java.util.Collection public final boolean isEmpty() { return this.d.e() == 0; } @Override // java.util.Set, java.util.Collection, java.lang.Iterable public final Iterator iterator() { return new HBt(this.d, 0); } @Override // java.util.Set, java.util.Collection public final boolean remove(Object obj) { int b = this.d.b(obj); if (b < 0) { return false; } this.d.a(b); return true; } @Override // java.util.Set, java.util.Collection public final boolean removeAll(Collection collection) { Map b = this.d.b(); int size = b.size(); Iterator it = collection.iterator(); while (it.hasNext()) { b.remove(it.next()); } return size != b.size(); } @Override // java.util.Set, java.util.Collection public final boolean retainAll(Collection collection) { return qXr.d(this.d.b(), collection); } @Override // java.util.Set, java.util.Collection public final int size() { return this.d.e(); } @Override // java.util.Set, java.util.Collection public final Object[] toArray() { return this.d.b(0); } @Override // java.util.Set, java.util.Collection public final T[] toArray(T[] tArr) { return (T[]) this.d.e(tArr, 0); } @Override // java.util.Set, java.util.Collection public final boolean equals(Object obj) { return qXr.a(this, obj); } @Override // java.util.Set, java.util.Collection public final int hashCode() { int i = 0; for (int e = this.d.e() - 1; e >= 0; e--) { Object e2 = this.d.e(e, 0); i += e2 == null ? 0 : e2.hashCode(); } return i; } } /* loaded from: classes.dex */ final class Sts implements Collection { final qXr a; /* JADX INFO: Access modifiers changed from: package-private */ public Sts(qXr qxr) { this.a = qxr; } @Override // java.util.Collection public final boolean add(V v) { throw new UnsupportedOperationException(); } @Override // java.util.Collection public final boolean addAll(Collection collection) { throw new UnsupportedOperationException(); } @Override // java.util.Collection public final void clear() { this.a.a(); } @Override // java.util.Collection public final boolean contains(Object obj) { return this.a.a(obj) >= 0; } @Override // java.util.Collection public final boolean containsAll(Collection collection) { Iterator it = collection.iterator(); while (it.hasNext()) { if (!contains(it.next())) { return false; } } return true; } @Override // java.util.Collection public final boolean isEmpty() { return this.a.e() == 0; } @Override // java.util.Collection, java.lang.Iterable public final Iterator iterator() { return new HBt(this.a, 1); } @Override // java.util.Collection public final boolean remove(Object obj) { int a = this.a.a(obj); if (a < 0) { return false; } this.a.a(a); return true; } @Override // java.util.Collection public final boolean removeAll(Collection collection) { int e = this.a.e(); int i = 0; boolean z = false; while (i < e) { if (collection.contains(this.a.e(i, 1))) { this.a.a(i); i--; e--; z = true; } i++; } return z; } @Override // java.util.Collection public final boolean retainAll(Collection collection) { int e = this.a.e(); int i = 0; boolean z = false; while (i < e) { if (!collection.contains(this.a.e(i, 1))) { this.a.a(i); i--; e--; z = true; } i++; } return z; } @Override // java.util.Collection public final int size() { return this.a.e(); } @Override // java.util.Collection public final Object[] toArray() { return this.a.b(1); } @Override // java.util.Collection public final T[] toArray(T[] tArr) { return (T[]) this.a.e(tArr, 1); } } public static boolean d(Map map, Collection collection) { int size = map.size(); Iterator it = map.keySet().iterator(); while (it.hasNext()) { if (!collection.contains(it.next())) { it.remove(); } } return size != map.size(); } public final Object[] b(int i) { int e = e(); Object[] objArr = new Object[e]; for (int i2 = 0; i2 < e; i2++) { objArr[i2] = e(i2, i); } return objArr; } public final T[] e(T[] tArr, int i) { int e = e(); if (tArr.length < e) { tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), e)); } for (int i2 = 0; i2 < e; i2++) { tArr[i2] = e(i2, i); } if (tArr.length > e) { tArr[e] = null; } return tArr; } public static boolean a(Set set, Object obj) { if (set == obj) { return true; } if (obj instanceof Set) { Set set2 = (Set) obj; try { if (set.size() == set2.size()) { if (set.containsAll(set2)) { return true; } } return false; } catch (ClassCastException | NullPointerException unused) { } } return false; } }