package o;

import android.view.MenuItem;
import java.util.HashMap;
import java.util.Iterator;
import java.util.concurrent.CopyOnWriteArrayList;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* loaded from: classes.dex */
public final class IO {
    public final Runnable a;
    public final CopyOnWriteArrayList b = new CopyOnWriteArrayList();
    public final HashMap c = new HashMap();

    public IO(Runnable runnable) {
        this.a = runnable;
    }

    public final boolean a(MenuItem menuItem) {
        Iterator it = this.b.iterator();
        while (it.hasNext()) {
            if (((C0698aC) ((InterfaceC1189fP) it.next())).a.o(menuItem)) {
                return true;
            }
        }
        return false;
    }

    public final void b(InterfaceC1189fP interfaceC1189fP) {
        this.b.remove(interfaceC1189fP);
        HO ho = (HO) this.c.remove(interfaceC1189fP);
        if (ho != null) {
            ho.a.c(ho.b);
            ho.b = null;
        }
        this.a.run();
    }
}
