Collection<StructureViewTreeElement> (PsiClass aClass) { if (aClass == null) return Collections.emptyList(); LinkedHashSet<PsiElement> members = getOwnChildren(aClass); List<StructureViewTreeElement> children = new ArrayList<>(members.size()); for (PsiElement child : members) { if (!child.isValid()) continue; if (child instanceof PsiClass) { children.add(new JavaClassTreeElement((PsiClass)child, false)); } else if (child instanceof PsiField) { children.add(new PsiFieldTreeElement((PsiField)child, false)); } else if (child instanceof PsiMethod) { children.add(new PsiMethodTreeElement((PsiMethod)child, false)); } else if (child instanceof PsiClassInitializer) { children.add(new ClassInitializerTreeElement((PsiClassInitializer)child)); } } PsiRecordHeader header = aClass.getRecordHeader(); if (header != null) { for (PsiRecordComponent recordComponent : header.getRecordComponents()) { children.add(new JavaRecordComponentTreeElement(recordComponent, false)); } } return children; }