List<CommitNode> (@NotNull List<DefaultMutableTreeNode> selectedNodes) { //addAll Commit nodes from selected Repository nodes; List<CommitNode> nodes = StreamEx.of(selectedNodes) .select(RepositoryNode.class) .toFlatList(node -> getChildNodesByType(node, CommitNode.class, true)); // add all others selected Commit nodes; nodes.addAll(StreamEx.of(selectedNodes) .select(CommitNode.class) .filter(node -> !nodes.contains(node)) .toList()); return nodes; }