Interface UBtree<T>


  • public interface UBtree<T>
    Unbalanced tree implementation to manage hierarchy data
    Since:
    1.0.0
    Author:
    Abhishek Kumar
    • Method Detail

      • createTree

        default List<Node<T>> createTree​(List<T> list)
        Method to create an unbalanced tree using the input list
        Parameters:
        list - input list
        Returns:
        list of Node
      • findLeafs

        default List<Node<T>> findLeafs​(Node<T> node)
        Method to find the leaf nodes using the passed node
        Parameters:
        node - input node
        Returns:
        List of leaf Node
      • findLeafsValue

        default List<T> findLeafsValue​(Node<T> node)
        Parameters:
        node -
        Returns:
      • findRootNode

        default Node<T> findRootNode​(Node<T> node)
        Method to find the root node for the input node
        Parameters:
        node - input node
        Returns:
        root Node
      • findRootNodeValue

        default T findRootNodeValue​(Node<T> node)
        Method to find the root node and their value
        Parameters:
        node - input node
        Returns:
        node value
      • getChildHierarchy

        default List<T> getChildHierarchy​(Node<T> node)
        Method to fetch the hierarchy for the input node
        Parameters:
        node - input node
        Returns:
        List of node value
      • getParentHierarchy

        default List<T> getParentHierarchy​(Node<T> node)
      • searchNode

        default Node<T> searchNode​(Node<T> root,
                                   String id)
        Method to Search Node the specified node
        Parameters:
        root - input root node
        id - id of the node
        Returns:
        Node
      • findNode

        default Node<T> findNode​(List<Node<T>> list,
                                 String id)
        Method to find the Node from the list of Node
        Parameters:
        list - input list of Node
        id - input to search the Node
        Returns:
        Node
      • convertToNode

        Node<T> convertToNode​(T node)