package ῲ.㴹;

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;

/* renamed from: ῲ.㴹.ⁱ  reason: contains not printable characters */
/* compiled from: MapCollections */
public abstract class AbstractC2278<K, V> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public AbstractC2278<K, V>.C2280 f7876;

    /* renamed from: ῲ  reason: contains not printable characters */
    public AbstractC2278<K, V>.C2279 f7877;

    /* renamed from: K  reason: contains not printable characters */
    public AbstractC2278<K, V>.C2281 f7878;

    /* renamed from: ῲ.㴹.ⁱ$ʬ  reason: contains not printable characters */
    /* compiled from: MapCollections */
    public final class C2279 implements Set<K> {
        public C2279() {
        }

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

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

        public void clear() {
            AbstractC2278.this.m5948();
        }

        public boolean contains(Object obj) {
            return AbstractC2278.this.m5945(obj) >= 0;
        }

        @Override // java.util.Collection, java.util.Set
        public boolean containsAll(Collection<?> collection) {
            Map<K, V> r0 = AbstractC2278.this.m5943();
            Iterator<?> it2 = collection.iterator();
            while (it2.hasNext()) {
                if (!r0.containsKey(it2.next())) {
                    return false;
                }
            }
            return true;
        }

        public boolean equals(Object obj) {
            return AbstractC2278.m5940((Set) this, obj);
        }

        public int hashCode() {
            int i;
            int i2 = 0;
            for (int r0 = AbstractC2278.this.m5941() - 1; r0 >= 0; r0--) {
                Object r3 = AbstractC2278.this.m5946(r0, 0);
                if (r3 == null) {
                    i = 0;
                } else {
                    i = r3.hashCode();
                }
                i2 += i;
            }
            return i2;
        }

        public boolean isEmpty() {
            return AbstractC2278.this.m5941() == 0;
        }

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

        public boolean remove(Object obj) {
            int r2 = AbstractC2278.this.m5945(obj);
            if (r2 < 0) {
                return false;
            }
            AbstractC2278.this.m5949(r2);
            return true;
        }

        @Override // java.util.Collection, java.util.Set
        public boolean removeAll(Collection<?> collection) {
            Map<K, V> r0 = AbstractC2278.this.m5943();
            int size = r0.size();
            Iterator<?> it2 = collection.iterator();
            while (it2.hasNext()) {
                r0.remove(it2.next());
            }
            return size != r0.size();
        }

        @Override // java.util.Collection, java.util.Set
        public boolean retainAll(Collection<?> collection) {
            return AbstractC2278.m5939((Map) AbstractC2278.this.m5943(), collection);
        }

        public int size() {
            return AbstractC2278.this.m5941();
        }

        public Object[] toArray() {
            return AbstractC2278.this.m5944(0);
        }

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

    /* renamed from: ῲ.㴹.ⁱ$ඓ  reason: contains not printable characters */
    /* compiled from: MapCollections */
    public final class C2280 implements Collection<V> {
        public C2280() {
        }

        @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();
        }

        public void clear() {
            AbstractC2278.this.m5948();
        }

        public boolean contains(Object obj) {
            return AbstractC2278.this.m5942(obj) >= 0;
        }

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

        public boolean isEmpty() {
            return AbstractC2278.this.m5941() == 0;
        }

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

        public boolean remove(Object obj) {
            int r2 = AbstractC2278.this.m5942(obj);
            if (r2 < 0) {
                return false;
            }
            AbstractC2278.this.m5949(r2);
            return true;
        }

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

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

        public int size() {
            return AbstractC2278.this.m5941();
        }

        public Object[] toArray() {
            return AbstractC2278.this.m5944(1);
        }

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

    /* renamed from: ῲ.㴹.ⁱ$ῲ  reason: contains not printable characters */
    /* compiled from: MapCollections */
    public final class C2281 implements Set<Map.Entry<K, V>> {
        public C2281() {
        }

        @Override // java.util.Collection, java.util.Set
        public boolean add(Object obj) {
            Map.Entry entry = (Map.Entry) obj;
            throw new UnsupportedOperationException();
        }

        /* JADX DEBUG: Multi-variable search result rejected for r2v0, resolved type: ῲ.㴹.ⁱ */
        /* JADX WARN: Multi-variable type inference failed */
        @Override // java.util.Collection, java.util.Set
        public boolean addAll(Collection<? extends Map.Entry<K, V>> collection) {
            int r0 = AbstractC2278.this.m5941();
            Iterator<? extends Map.Entry<K, V>> it2 = collection.iterator();
            while (it2.hasNext()) {
                Map.Entry entry = (Map.Entry) it2.next();
                AbstractC2278.this.m5950(entry.getKey(), entry.getValue());
            }
            return r0 != AbstractC2278.this.m5941();
        }

        public void clear() {
            AbstractC2278.this.m5948();
        }

        public boolean contains(Object obj) {
            if (!(obj instanceof Map.Entry)) {
                return false;
            }
            Map.Entry entry = (Map.Entry) obj;
            int r0 = AbstractC2278.this.m5945(entry.getKey());
            if (r0 < 0) {
                return false;
            }
            return C2287.m5970(AbstractC2278.this.m5946(r0, 1), entry.getValue());
        }

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

        public boolean equals(Object obj) {
            return AbstractC2278.m5940((Set) this, obj);
        }

        public int hashCode() {
            int i;
            int i2;
            int i3 = 0;
            for (int r0 = AbstractC2278.this.m5941() - 1; r0 >= 0; r0--) {
                Object r4 = AbstractC2278.this.m5946(r0, 0);
                Object r5 = AbstractC2278.this.m5946(r0, 1);
                if (r4 == null) {
                    i = 0;
                } else {
                    i = r4.hashCode();
                }
                if (r5 == null) {
                    i2 = 0;
                } else {
                    i2 = r5.hashCode();
                }
                i3 += i ^ i2;
            }
            return i3;
        }

        public boolean isEmpty() {
            return AbstractC2278.this.m5941() == 0;
        }

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

        public boolean remove(Object obj) {
            throw new UnsupportedOperationException();
        }

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

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

        public int size() {
            return AbstractC2278.this.m5941();
        }

        public Object[] toArray() {
            throw new UnsupportedOperationException();
        }

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

    /* renamed from: ῲ.㴹.ⁱ$K  reason: contains not printable characters */
    /* compiled from: MapCollections */
    public final class C2282<T> implements Iterator<T> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f7882;

        /* renamed from: ඓ  reason: contains not printable characters */
        public boolean f7883 = false;

        /* renamed from: ῲ  reason: contains not printable characters */
        public final int f7884;

        /* renamed from: 㸾  reason: contains not printable characters */
        public int f7886;

        public C2282(int i) {
            this.f7884 = i;
            this.f7882 = AbstractC2278.this.m5941();
        }

        public boolean hasNext() {
            return this.f7886 < this.f7882;
        }

        @Override // java.util.Iterator
        public T next() {
            if (hasNext()) {
                T t = (T) AbstractC2278.this.m5946(this.f7886, this.f7884);
                this.f7886++;
                this.f7883 = true;
                return t;
            }
            throw new NoSuchElementException();
        }

        public void remove() {
            if (this.f7883) {
                this.f7886--;
                this.f7882--;
                this.f7883 = false;
                AbstractC2278.this.m5949(this.f7886);
                return;
            }
            throw new IllegalStateException();
        }
    }

    /* renamed from: ῲ.㴹.ⁱ$㸾  reason: contains not printable characters */
    /* compiled from: MapCollections */
    public final class C2283 implements Iterator<Map.Entry<K, V>>, Map.Entry<K, V> {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f7887;

        /* renamed from: ῲ  reason: contains not printable characters */
        public int f7889;

        /* renamed from: 㸾  reason: contains not printable characters */
        public boolean f7890 = false;

        public C2283() {
            this.f7889 = AbstractC2278.this.m5941() - 1;
            this.f7887 = -1;
        }

        public boolean equals(Object obj) {
            if (!this.f7890) {
                throw new IllegalStateException("This container does not support retaining Map.Entry objects");
            } else if (!(obj instanceof Map.Entry)) {
                return false;
            } else {
                Map.Entry entry = (Map.Entry) obj;
                if (!C2287.m5970(entry.getKey(), AbstractC2278.this.m5946(this.f7887, 0)) || !C2287.m5970(entry.getValue(), AbstractC2278.this.m5946(this.f7887, 1))) {
                    return false;
                }
                return true;
            }
        }

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

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

        public boolean hasNext() {
            return this.f7887 < this.f7889;
        }

        public int hashCode() {
            int i;
            if (this.f7890) {
                int i2 = 0;
                Object r0 = AbstractC2278.this.m5946(this.f7887, 0);
                Object r1 = AbstractC2278.this.m5946(this.f7887, 1);
                if (r0 == null) {
                    i = 0;
                } else {
                    i = r0.hashCode();
                }
                if (r1 != null) {
                    i2 = r1.hashCode();
                }
                return i ^ i2;
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

        @Override // java.util.Iterator
        public Object next() {
            if (hasNext()) {
                this.f7887++;
                this.f7890 = true;
                return this;
            }
            throw new NoSuchElementException();
        }

        public void remove() {
            if (this.f7890) {
                AbstractC2278.this.m5949(this.f7887);
                this.f7887--;
                this.f7889--;
                this.f7890 = false;
                return;
            }
            throw new IllegalStateException();
        }

        @Override // java.util.Map.Entry
        public V setValue(V v) {
            if (this.f7890) {
                return (V) AbstractC2278.this.m5947(this.f7887, v);
            }
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }

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

    /* renamed from: K  reason: contains not printable characters */
    public static <K, V> boolean m5939(Map<K, V> map, Collection<?> collection) {
        int size = map.size();
        Iterator<K> it2 = map.keySet().iterator();
        while (it2.hasNext()) {
            if (!collection.contains(it2.next())) {
                it2.remove();
            }
        }
        return size != map.size();
    }

    /* renamed from: ʬ  reason: contains not printable characters */
    public abstract int m5941();

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract int m5942(Object obj);

    /* renamed from: ῲ  reason: contains not printable characters */
    public abstract Map<K, V> m5943();

    /* renamed from: ῲ  reason: contains not printable characters */
    public Object[] m5944(int i) {
        int r0 = m5941();
        Object[] objArr = new Object[r0];
        for (int i2 = 0; i2 < r0; i2++) {
            objArr[i2] = m5946(i2, i);
        }
        return objArr;
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract int m5945(Object obj);

    /* renamed from: K  reason: contains not printable characters */
    public abstract Object m5946(int i, int i2);

    /* renamed from: K  reason: contains not printable characters */
    public abstract V m5947(int i, V v);

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m5948();

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m5949(int i);

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m5950(K k, V v);

    /* JADX DEBUG: Multi-variable search result rejected for r4v9, resolved type: T[] */
    /* JADX WARN: Multi-variable type inference failed */
    /* renamed from: K  reason: contains not printable characters */
    public <T> T[] m5951(T[] tArr, int i) {
        int r0 = m5941();
        if (tArr.length < r0) {
            tArr = (T[]) ((Object[]) Array.newInstance(tArr.getClass().getComponentType(), r0));
        }
        for (int i2 = 0; i2 < r0; i2++) {
            tArr[i2] = m5946(i2, i);
        }
        if (tArr.length > r0) {
            tArr[r0] = null;
        }
        return tArr;
    }

    /* renamed from: K  reason: contains not printable characters */
    public static <T> boolean m5940(Set<T> set, Object obj) {
        if (set == obj) {
            return true;
        }
        if (obj instanceof Set) {
            Set set2 = (Set) obj;
            try {
                if (set.size() != set2.size() || !set.containsAll(set2)) {
                    return false;
                }
                return true;
            } catch (ClassCastException | NullPointerException unused) {
            }
        }
        return false;
    }
}
