FileTemplateNode () { SortedSet<FileTemplateGroupDescriptor> categories = new TreeSet<>(Comparator.comparing(FileTemplateGroupDescriptor::getTitle)); for (FileTemplateGroupDescriptorFactory templateGroupFactory : factories) { ContainerUtil.addIfNotNull(categories, templateGroupFactory.getFileTemplatesDescriptor()); } return new FileTemplateNode("ROOT", null, ContainerUtil.map(categories, FileTemplateNode::new)); }