Collection<XmlFile> (XmlFile element) { final CommonProcessors.CollectUniquesProcessor<XmlFile> processor = new CommonProcessors.CollectUniquesProcessor<>() { @Override public boolean process(XmlFile file) { if (!getResults().contains(file)) { XsltIncludeIndex.processForwardDependencies(file, this); } return super.process(file); } }; XsltIncludeIndex.processForwardDependencies(element, processor); return processor.getResults(); }