Class Tree<T>

java.lang.Object
io.jmix.core.common.datastruct.Tree<T>
Type Parameters:
T - type of tree node data
All Implemented Interfaces:
Serializable

public class Tree<T> extends Object implements Serializable
See Also:
  • Constructor Details

    • Tree

      public Tree()
    • Tree

      public Tree(Node<T> root)
    • Tree

      public Tree(List<Node<T>> rootNodes)
  • Method Details

    • getRootNode

      @Nullable public Node<T> getRootNode()
      Return the first root Node of the tree.
      Returns:
      the root element.
    • getRootNodes

      public List<Node<T>> getRootNodes()
      Return the root nodes of the tree.
      Returns:
      the root elements.
    • setRootNodes

      public void setRootNodes(List<Node<T>> rootNodes)
      Set the root Element for the tree.
      Parameters:
      rootNodes - the root element to set.
    • toList

      public List<Node<T>> toList()
      Returns the Tree<T> as a List of Node<T> objects. The elements of the List are generated from a pre-order traversal of the tree.
      Returns:
      a List<Node<T>>.
    • toString

      public String toString()
      Returns a String representation of the Tree. The elements are generated from a pre-order traversal of the Tree.
      Overrides:
      toString in class Object
      Returns:
      the String representation of the Tree.