Collection<FrameworkSupportNodeBase> (List<? extends FrameworkSupportInModuleProvider> providers, Set<String> associated, final Collection<String> preselected) { Map<String, FrameworkSupportNode> nodes = new HashMap<>(); Map<FrameworkGroup<?>, FrameworkGroupNode> groups = new HashMap<>(); List<FrameworkSupportNodeBase> roots = new ArrayList<>(); Map<String, FrameworkSupportNodeBase> associatedNodes = new LinkedHashMap<>(); for (FrameworkSupportInModuleProvider provider : providers) { createNode(provider, nodes, groups, roots, providers, associated, associatedNodes); } FrameworkSupportNodeBase.sortByName(roots, (o1, o2) -> Boolean.compare(preselected.contains(o2.getId()), preselected.contains(o1.getId()))); myRoots = roots; return associatedNodes.values(); }