Deque<TreePath> (@NotNull TreeModel model, @NotNull TreePath path) { Object object = path.getLastPathComponent(); int count = model.getChildCount(object); Deque<TreePath> deque = new ArrayDeque<>(count); for (int i = 0; i < count; i++) { deque.add(path.pathByAddingChild(model.getChild(object, i))); } return deque; }