List<SimpleNode> (SimpleTree tree) { List<SimpleNode> nodes = new ArrayList<>(); TreePath[] treePaths = tree.getSelectionPaths(); if (treePaths != null) { for (TreePath treePath : treePaths) { nodes.add(tree.getNodeFor(treePath)); } } return nodes; }