List<PathElement[]> (@NotNull JTree tree, @NotNull List<? extends TreePath> paths) { List<PathElement[]> list = new ArrayList<>(); for (TreePath o : paths) { if (o.getPathCount() > 1 || tree.isRootVisible()) { list.add(createPath(tree.getModel(), o)); } } return list; }