package androidx.collection;

import java.util.Iterator;
import java.util.Map;
import java.util.NoSuchElementException;

/* JADX INFO: loaded from: classes.dex */
public final class d implements Iterator, Map.Entry {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public int f928a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public int f929b = -1;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public boolean f930c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ f f931d;

    public d(f fVar) {
        this.f931d = fVar;
        this.f928a = fVar.f968c - 1;
    }

    @Override // java.util.Map.Entry
    public final boolean equals(Object obj) {
        if (!this.f930c) {
            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;
        Object key = entry.getKey();
        int i10 = this.f929b;
        f fVar = this.f931d;
        return nb.g.c(key, fVar.i(i10)) && nb.g.c(entry.getValue(), fVar.m(this.f929b));
    }

    @Override // java.util.Map.Entry
    public final Object getKey() {
        if (this.f930c) {
            return this.f931d.i(this.f929b);
        }
        throw new IllegalStateException("This container does not support retaining Map.Entry objects");
    }

    @Override // java.util.Map.Entry
    public final Object getValue() {
        if (this.f930c) {
            return this.f931d.m(this.f929b);
        }
        throw new IllegalStateException("This container does not support retaining Map.Entry objects");
    }

    @Override // java.util.Iterator
    public final boolean hasNext() {
        return this.f929b < this.f928a;
    }

    @Override // java.util.Map.Entry
    public final int hashCode() {
        if (!this.f930c) {
            throw new IllegalStateException("This container does not support retaining Map.Entry objects");
        }
        int i10 = this.f929b;
        f fVar = this.f931d;
        Object objI = fVar.i(i10);
        Object objM = fVar.m(this.f929b);
        return (objI == null ? 0 : objI.hashCode()) ^ (objM != null ? objM.hashCode() : 0);
    }

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

    @Override // java.util.Iterator
    public final void remove() {
        if (!this.f930c) {
            throw new IllegalStateException();
        }
        this.f931d.k(this.f929b);
        this.f929b--;
        this.f928a--;
        this.f930c = false;
    }

    @Override // java.util.Map.Entry
    public final Object setValue(Object obj) {
        if (this.f930c) {
            return this.f931d.l(this.f929b, obj);
        }
        throw new IllegalStateException("This container does not support retaining Map.Entry objects");
    }

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