package X6FRs_4.Mqv2r_3;

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;
/* compiled from: MapCollections.java */
/* loaded from: classes.dex */
public abstract class IFxWkV_5<K, V> {
    public IFxWkV_5<K, V>.PGPF6hQ_2 KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public IFxWkV_5<K, V>.QxJ9d_1 f1000KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public IFxWkV_5<K, V>.X6FRs_4 f1001KQgRr5e_0;

    /* compiled from: MapCollections.java */
    /* loaded from: classes.dex */
    public final class KQgRr5e_0<T> implements Iterator<T> {
        public final int KQgRr5e_0;
        public int PGPF6hQ_2;
        public int QxJ9d_1;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public boolean f1003QxJ9d_1 = false;

        public KQgRr5e_0(int i) {
            this.KQgRr5e_0 = i;
            this.QxJ9d_1 = IFxWkV_5.this.KQgRr5e_0();
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.PGPF6hQ_2 < this.QxJ9d_1;
        }

        @Override // java.util.Iterator
        public T next() {
            if (hasNext()) {
                T t = (T) IFxWkV_5.this.KQgRr5e_0(this.PGPF6hQ_2, this.KQgRr5e_0);
                this.PGPF6hQ_2++;
                this.f1003QxJ9d_1 = true;
                return t;
            }
            throw new NoSuchElementException();
        }

        @Override // java.util.Iterator
        public void remove() {
            if (this.f1003QxJ9d_1) {
                int i = this.PGPF6hQ_2 - 1;
                this.PGPF6hQ_2 = i;
                this.QxJ9d_1--;
                this.f1003QxJ9d_1 = false;
                IFxWkV_5.this.KQgRr5e_0(i);
                return;
            }
            throw new IllegalStateException();
        }
    }

    /* compiled from: MapCollections.java */
    /* loaded from: classes.dex */
    public final class Mqv2r_3 implements Iterator<Map.Entry<K, V>>, Map.Entry<K, V> {
        public int KQgRr5e_0;

        /* renamed from: QxJ9d_1  reason: collision with other field name */
        public boolean f1005QxJ9d_1 = false;
        public int QxJ9d_1 = -1;

        public Mqv2r_3() {
            this.KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0() - 1;
        }

        public Map.Entry<K, V> KQgRr5e_0() {
            if (hasNext()) {
                this.QxJ9d_1++;
                this.f1005QxJ9d_1 = true;
                return this;
            }
            throw new NoSuchElementException();
        }

        @Override // java.util.Map.Entry
        public boolean equals(Object obj) {
            if (this.f1005QxJ9d_1) {
                if (obj instanceof Map.Entry) {
                    Map.Entry entry = (Map.Entry) obj;
                    return X6FRs_4.Mqv2r_3.PGPF6hQ_2.KQgRr5e_0(entry.getKey(), IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 0)) && X6FRs_4.Mqv2r_3.PGPF6hQ_2.KQgRr5e_0(entry.getValue(), IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 1));
                }
                return false;
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        @Override // java.util.Map.Entry
        public K getKey() {
            if (this.f1005QxJ9d_1) {
                return (K) IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 0);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        @Override // java.util.Map.Entry
        public V getValue() {
            if (this.f1005QxJ9d_1) {
                return (V) IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 1);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        @Override // java.util.Iterator
        public boolean hasNext() {
            return this.QxJ9d_1 < this.KQgRr5e_0;
        }

        @Override // java.util.Map.Entry
        public int hashCode() {
            if (this.f1005QxJ9d_1) {
                Object KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 0);
                Object KQgRr5e_02 = IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, 1);
                return (KQgRr5e_0 == null ? 0 : KQgRr5e_0.hashCode()) ^ (KQgRr5e_02 != null ? KQgRr5e_02.hashCode() : 0);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        @Override // java.util.Iterator
        public /* bridge */ /* synthetic */ Object next() {
            KQgRr5e_0();
            return this;
        }

        @Override // java.util.Iterator
        public void remove() {
            if (this.f1005QxJ9d_1) {
                IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1);
                this.QxJ9d_1--;
                this.KQgRr5e_0--;
                this.f1005QxJ9d_1 = false;
                return;
            }
            throw new IllegalStateException();
        }

        @Override // java.util.Map.Entry
        public V setValue(V v) {
            if (this.f1005QxJ9d_1) {
                return (V) IFxWkV_5.this.KQgRr5e_0(this.QxJ9d_1, (int) v);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        public String toString() {
            return getKey() + "=" + getValue();
        }
    }

    /* compiled from: MapCollections.java */
    /* loaded from: classes.dex */
    public final class PGPF6hQ_2 implements Set<K> {
        public PGPF6hQ_2() {
        }

        @Override // java.util.Set, java.util.Collection
        public boolean add(K k) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean addAll(Collection<? extends K> collection) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public void clear() {
            IFxWkV_5.this.m499KQgRr5e_0();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean contains(Object obj) {
            return IFxWkV_5.this.KQgRr5e_0(obj) >= 0;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean containsAll(Collection<?> collection) {
            return IFxWkV_5.KQgRr5e_0((Map) IFxWkV_5.this.m497KQgRr5e_0(), collection);
        }

        @Override // java.util.Set, java.util.Collection
        public boolean equals(Object obj) {
            return IFxWkV_5.KQgRr5e_0((Set) this, obj);
        }

        @Override // java.util.Set, java.util.Collection
        public int hashCode() {
            int i = 0;
            for (int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0() - 1; KQgRr5e_0 >= 0; KQgRr5e_0--) {
                Object KQgRr5e_02 = IFxWkV_5.this.KQgRr5e_0(KQgRr5e_0, 0);
                i += KQgRr5e_02 == null ? 0 : KQgRr5e_02.hashCode();
            }
            return i;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean isEmpty() {
            return IFxWkV_5.this.KQgRr5e_0() == 0;
        }

        @Override // java.util.Set, java.util.Collection, java.lang.Iterable
        public Iterator<K> iterator() {
            return new KQgRr5e_0(0);
        }

        @Override // java.util.Set, java.util.Collection
        public boolean remove(Object obj) {
            int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0(obj);
            if (KQgRr5e_0 >= 0) {
                IFxWkV_5.this.KQgRr5e_0(KQgRr5e_0);
                return true;
            }
            return false;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean removeAll(Collection<?> collection) {
            return IFxWkV_5.QxJ9d_1(IFxWkV_5.this.m497KQgRr5e_0(), collection);
        }

        @Override // java.util.Set, java.util.Collection
        public boolean retainAll(Collection<?> collection) {
            return IFxWkV_5.PGPF6hQ_2(IFxWkV_5.this.m497KQgRr5e_0(), collection);
        }

        @Override // java.util.Set, java.util.Collection
        public int size() {
            return IFxWkV_5.this.KQgRr5e_0();
        }

        @Override // java.util.Set, java.util.Collection
        public Object[] toArray() {
            return IFxWkV_5.this.m500KQgRr5e_0(0);
        }

        @Override // java.util.Set, java.util.Collection
        public <T> T[] toArray(T[] tArr) {
            return (T[]) IFxWkV_5.this.KQgRr5e_0(tArr, 0);
        }
    }

    /* compiled from: MapCollections.java */
    /* loaded from: classes.dex */
    public final class QxJ9d_1 implements Set<Map.Entry<K, V>> {
        public QxJ9d_1() {
        }

        public boolean KQgRr5e_0(Map.Entry<K, V> entry) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public /* bridge */ /* synthetic */ boolean add(Object obj) {
            KQgRr5e_0((Map.Entry) obj);
            throw null;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean addAll(Collection<? extends Map.Entry<K, V>> collection) {
            int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0();
            for (Map.Entry<K, V> entry : collection) {
                IFxWkV_5.this.KQgRr5e_0((IFxWkV_5) entry.getKey(), (K) entry.getValue());
            }
            return KQgRr5e_0 != IFxWkV_5.this.KQgRr5e_0();
        }

        @Override // java.util.Set, java.util.Collection
        public void clear() {
            IFxWkV_5.this.m499KQgRr5e_0();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean contains(Object obj) {
            if (obj instanceof Map.Entry) {
                Map.Entry entry = (Map.Entry) obj;
                int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0(entry.getKey());
                if (KQgRr5e_0 < 0) {
                    return false;
                }
                return X6FRs_4.Mqv2r_3.PGPF6hQ_2.KQgRr5e_0(IFxWkV_5.this.KQgRr5e_0(KQgRr5e_0, 1), entry.getValue());
            }
            return false;
        }

        @Override // java.util.Set, java.util.Collection
        public 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 boolean equals(Object obj) {
            return IFxWkV_5.KQgRr5e_0((Set) this, obj);
        }

        @Override // java.util.Set, java.util.Collection
        public int hashCode() {
            int i = 0;
            for (int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0() - 1; KQgRr5e_0 >= 0; KQgRr5e_0--) {
                Object KQgRr5e_02 = IFxWkV_5.this.KQgRr5e_0(KQgRr5e_0, 0);
                Object KQgRr5e_03 = IFxWkV_5.this.KQgRr5e_0(KQgRr5e_0, 1);
                i += (KQgRr5e_02 == null ? 0 : KQgRr5e_02.hashCode()) ^ (KQgRr5e_03 == null ? 0 : KQgRr5e_03.hashCode());
            }
            return i;
        }

        @Override // java.util.Set, java.util.Collection
        public boolean isEmpty() {
            return IFxWkV_5.this.KQgRr5e_0() == 0;
        }

        @Override // java.util.Set, java.util.Collection, java.lang.Iterable
        public Iterator<Map.Entry<K, V>> iterator() {
            return new Mqv2r_3();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean remove(Object obj) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean removeAll(Collection<?> collection) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public boolean retainAll(Collection<?> collection) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public int size() {
            return IFxWkV_5.this.KQgRr5e_0();
        }

        @Override // java.util.Set, java.util.Collection
        public Object[] toArray() {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Set, java.util.Collection
        public <T> T[] toArray(T[] tArr) {
            throw new UnsupportedOperationException();
        }
    }

    /* compiled from: MapCollections.java */
    /* loaded from: classes.dex */
    public final class X6FRs_4 implements Collection<V> {
        public X6FRs_4() {
        }

        @Override // java.util.Collection
        public boolean add(V v) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Collection
        public boolean addAll(Collection<? extends V> collection) {
            throw new UnsupportedOperationException();
        }

        @Override // java.util.Collection
        public void clear() {
            IFxWkV_5.this.m499KQgRr5e_0();
        }

        @Override // java.util.Collection
        public boolean contains(Object obj) {
            return IFxWkV_5.this.QxJ9d_1(obj) >= 0;
        }

        @Override // java.util.Collection
        public boolean containsAll(Collection<?> collection) {
            Iterator<?> it = collection.iterator();
            while (it.hasNext()) {
                if (!contains(it.next())) {
                    return false;
                }
            }
            return true;
        }

        @Override // java.util.Collection
        public boolean isEmpty() {
            return IFxWkV_5.this.KQgRr5e_0() == 0;
        }

        @Override // java.util.Collection, java.lang.Iterable
        public Iterator<V> iterator() {
            return new KQgRr5e_0(1);
        }

        @Override // java.util.Collection
        public boolean remove(Object obj) {
            int QxJ9d_1 = IFxWkV_5.this.QxJ9d_1(obj);
            if (QxJ9d_1 >= 0) {
                IFxWkV_5.this.KQgRr5e_0(QxJ9d_1);
                return true;
            }
            return false;
        }

        @Override // java.util.Collection
        public boolean removeAll(Collection<?> collection) {
            int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0();
            int i = 0;
            boolean z = false;
            while (i < KQgRr5e_0) {
                if (collection.contains(IFxWkV_5.this.KQgRr5e_0(i, 1))) {
                    IFxWkV_5.this.KQgRr5e_0(i);
                    i--;
                    KQgRr5e_0--;
                    z = true;
                }
                i++;
            }
            return z;
        }

        @Override // java.util.Collection
        public boolean retainAll(Collection<?> collection) {
            int KQgRr5e_0 = IFxWkV_5.this.KQgRr5e_0();
            int i = 0;
            boolean z = false;
            while (i < KQgRr5e_0) {
                if (!collection.contains(IFxWkV_5.this.KQgRr5e_0(i, 1))) {
                    IFxWkV_5.this.KQgRr5e_0(i);
                    i--;
                    KQgRr5e_0--;
                    z = true;
                }
                i++;
            }
            return z;
        }

        @Override // java.util.Collection
        public int size() {
            return IFxWkV_5.this.KQgRr5e_0();
        }

        @Override // java.util.Collection
        public Object[] toArray() {
            return IFxWkV_5.this.m500KQgRr5e_0(1);
        }

        @Override // java.util.Collection
        public <T> T[] toArray(T[] tArr) {
            return (T[]) IFxWkV_5.this.KQgRr5e_0(tArr, 1);
        }
    }

    public static <K, V> boolean KQgRr5e_0(Map<K, V> map, Collection<?> collection) {
        Iterator<?> it = collection.iterator();
        while (it.hasNext()) {
            if (!map.containsKey(it.next())) {
                return false;
            }
        }
        return true;
    }

    public static <K, V> boolean PGPF6hQ_2(Map<K, V> map, Collection<?> collection) {
        int size = map.size();
        Iterator<K> it = map.keySet().iterator();
        while (it.hasNext()) {
            if (!collection.contains(it.next())) {
                it.remove();
            }
        }
        return size != map.size();
    }

    public static <K, V> boolean QxJ9d_1(Map<K, V> map, Collection<?> collection) {
        int size = map.size();
        Iterator<?> it = collection.iterator();
        while (it.hasNext()) {
            map.remove(it.next());
        }
        return size != map.size();
    }

    public abstract int KQgRr5e_0();

    public abstract int KQgRr5e_0(Object obj);

    public abstract Object KQgRr5e_0(int i, int i2);

    public abstract V KQgRr5e_0(int i, V v);

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public abstract Map<K, V> m497KQgRr5e_0();

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public abstract void m499KQgRr5e_0();

    public abstract void KQgRr5e_0(int i);

    public abstract void KQgRr5e_0(K k, V v);

    public abstract int QxJ9d_1(Object obj);

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Object[] m500KQgRr5e_0(int i) {
        int KQgRr5e_02 = KQgRr5e_0();
        Object[] objArr = new Object[KQgRr5e_02];
        for (int i2 = 0; i2 < KQgRr5e_02; i2++) {
            objArr[i2] = KQgRr5e_0(i2, i);
        }
        return objArr;
    }

    public Set<K> QxJ9d_1() {
        if (this.KQgRr5e_0 == null) {
            this.KQgRr5e_0 = new PGPF6hQ_2();
        }
        return this.KQgRr5e_0;
    }

    /* JADX WARN: Multi-variable type inference failed */
    public <T> T[] KQgRr5e_0(T[] tArr, int i) {
        int KQgRr5e_02 = KQgRr5e_0();
        if (tArr.length < KQgRr5e_02) {
            tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), KQgRr5e_02));
        }
        for (int i2 = 0; i2 < KQgRr5e_02; i2++) {
            tArr[i2] = KQgRr5e_0(i2, i);
        }
        if (tArr.length > KQgRr5e_02) {
            tArr[KQgRr5e_02] = null;
        }
        return tArr;
    }

    public static <T> boolean KQgRr5e_0(Set<T> 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;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Set<Map.Entry<K, V>> m498KQgRr5e_0() {
        if (this.f1000KQgRr5e_0 == null) {
            this.f1000KQgRr5e_0 = new QxJ9d_1();
        }
        return this.f1000KQgRr5e_0;
    }

    /* renamed from: KQgRr5e_0  reason: collision with other method in class */
    public Collection<V> m496KQgRr5e_0() {
        if (this.f1001KQgRr5e_0 == null) {
            this.f1001KQgRr5e_0 = new X6FRs_4();
        }
        return this.f1001KQgRr5e_0;
    }
}
