itemsTree method

List itemsTree()

Gets a tree structure (as a nested list) corresponding to the structure of the items and nodes in this tree.

The returned {@link List}s contain either {@link Object} items, or Lists which correspond to subtrees of the tree Subtrees which do not contain any items are not included.

Builds the tree if necessary.

@return a List of items and/or Lists

Implementation

List itemsTree() {
  build();

  List? valuesTree = itemsTreeWithNode(root);
  if (valuesTree == null) return [];
  return valuesTree;
}