package ῲ.㿎.K;

import java.util.ArrayList;
import java.util.HashSet;
import ῲ.ᨨ.㿎.AbstractC1871;
import ῲ.ᨨ.㿎.C1866;
import ῲ.㴹.C2288;

/* renamed from: ῲ.㿎.K.K  reason: contains not printable characters */
/* compiled from: DirectedAcyclicGraph */
public final class C2298<T> {

    /* renamed from: ʬ  reason: contains not printable characters */
    public final ArrayList<T> f7951 = new ArrayList<>();

    /* renamed from: ῲ  reason: contains not printable characters */
    public final C2288<T, ArrayList<T>> f7952 = new C2288<>();

    /* renamed from: K  reason: contains not printable characters */
    public final AbstractC1871<ArrayList<T>> f7953 = new C1866(10);

    /* renamed from: 㸾  reason: contains not printable characters */
    public final HashSet<T> f7954 = new HashSet<>();

    /* renamed from: K  reason: contains not printable characters */
    public void m5993(T t) {
        if (!(this.f7952.m5977(t) >= 0)) {
            this.f7952.put(t, null);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m5994(T t, ArrayList<T> arrayList, HashSet<T> hashSet) {
        if (!arrayList.contains(t)) {
            if (!hashSet.contains(t)) {
                hashSet.add(t);
                ArrayList<T> orDefault = this.f7952.getOrDefault(t, null);
                if (orDefault != null) {
                    int size = orDefault.size();
                    for (int i = 0; i < size; i++) {
                        m5994(orDefault.get(i), arrayList, hashSet);
                    }
                }
                hashSet.remove(t);
                arrayList.add(t);
                return;
            }
            throw new RuntimeException("This graph contains cyclic dependencies");
        }
    }
}
