Collection<TemplateResource> () { Set<String> names = new HashSet<>(); Collection<TemplateResource> templates = new LinkedHashSet<>(getDefaultTemplates()); for (TemplateResource template : myState.templates) { if (names.add(template.getFileName())) { templates.add(template); } } return templates; }