Collection<String> (ModuleGrouper grouper) { Set<String> topLevelGroupNames = new HashSet<>(); for (final Module child : grouper.getAllModules()) { List<String> group = grouper.getGroupPath(child); if (!group.isEmpty()) { topLevelGroupNames.add(group.get(0)); } } return topLevelGroupNames; }