List<TreeNode> () { ThreadingAssertions.assertEventDispatchThread(); TreePath[] selectionPaths = myTree.getSelectionPaths(); return selectionPaths == null ? Collections.emptyList() : ContainerUtil.mapNotNull(selectionPaths, p-> ObjectUtils.tryCast(p.getLastPathComponent(), TreeNode.class)); }