Collection<Group> (@NotNull AbstractTreeNode<?> parent, @NotNull Collection<TreeElement> children) { if (parent.getValue() instanceof PropertyGroup) return Collections.emptyList(); Map<Group,Group> result = new HashMap<>(); for (TreeElement o : children) { if (o instanceof JavaClassTreeElementBase) { PsiElement element = ((JavaClassTreeElementBase<?>)o).getElement(); PropertyGroup group = PropertyGroup.createOn(element, o); if (group != null) { PropertyGroup existing = (PropertyGroup)result.get(group); if (existing != null) { existing.copyAccessorsFrom(group); } else { result.put(group, group); } } } } for (Iterator<Group> iterator = result.keySet().iterator(); iterator.hasNext();) { PropertyGroup group = (PropertyGroup)iterator.next(); if (!group.isComplete()) { iterator.remove(); } } return result.values(); }