Set<String> (Map<TemplateImpl, DefaultMutableTreeNode> templates) { Set<String> oldGroups = new HashSet<>(); for (TemplateImpl template : templates.keySet()) { oldGroups.add(template.getGroupName()); } return oldGroups; }