TreeState (@NotNull JTree tree, @NotNull List<TreePath> expandedPaths, @NotNull List<TreePath> selectedPaths) { List<PathElement[]> expandedPathElements = !expandedPaths.isEmpty() ? createPaths(tree, expandedPaths) : new ArrayList<>(); List<PathElement[]> selectedPathElements = !selectedPaths.isEmpty() ? createPaths(tree, selectedPaths) : new ArrayList<>(); return new TreeState(expandedPathElements, selectedPathElements); }