if (label.name().equals("#KApply")) { Term labelTerm = ((TermCons) child).get(0); Optional<KLabel> optLabel = klabelFromTerm(labelTerm); if (optLabel.isPresent() && m.productionsFor().contains(optLabel.get())) { Collection<Production> productions = mutable(m.productionsFor().get(optLabel.get()).get());