List<DuplicateNode> () { if (myDuplicatesGroup != null && myDuplicatesGroup.getChildCount() != 0) { List<DuplicateNode> duplicates = new ArrayList<>(); for (int i = 0; i < myDuplicatesGroup.getChildCount(); i++) { TreeNode node = myDuplicatesGroup.getChildAt(i); if (node instanceof DuplicateNode duplicateNode && !duplicateNode.isExcluded() && duplicateNode.isValid()) { duplicates.add(duplicateNode); } } return duplicates; } return Collections.emptyList(); }