Module gen.tree

Class BaseTreeNodeTransformer

    • Method Detail

      • toKeyMap

        public static <T,​K> java.util.Map<K,​TreeIdNode<T,​K>> toKeyMap​(@NonNull
                                                                                        @NonNull BaseTreeNode<T,​K> root)
        Transforms the given BaseTreeNode object to a Map object with the key and the corresponding TreeIdNode objects
        Type Parameters:
        T - the generic type of the value
        K - the generic type of the id of the node
        Parameters:
        root - the BaseTreeNode object to transform
        Returns:
        a Map object with the corresponding TreeIdNode objects
      • toTreeIdNode

        public static <T,​K> TreeIdNode<T,​K> toTreeIdNode​(@NonNull
                                                                     @NonNull BaseTreeNode<T,​K> baseTreeNode)
        Transforms the given BaseTreeNode object to a TreeIdNode object
        Type Parameters:
        T - the generic type of the value
        K - the generic type of the id of the node
        Parameters:
        baseTreeNode - the BaseTreeNode object to convert
        Returns:
        the new created TreeIdNode object
      • toKeyBaseTreeNodeMap

        public static <T,​K> java.util.Map<K,​BaseTreeNode<T,​K>> toKeyBaseTreeNodeMap​(@NonNull
                                                                                                      @NonNull BaseTreeNode<T,​K> root)
        Transforms the given BaseTreeNode object to a Map object with the key and the corresponding BaseTreeNode objects
        Type Parameters:
        T - the generic type of the value
        K - the generic type of the id of the node
        Parameters:
        root - the BaseTreeNode object to transform
        Returns:
        a Map object with the corresponding BaseTreeNode objects
      • transform

        public static <T,​K> java.util.Map<K,​BaseTreeNode<T,​K>> transform​(@NonNull
                                                                                           @NonNull java.util.Map<K,​TreeIdNode<T,​K>> treeIdNodeMap)
        Transforms the given Map object that contains TreeIdNode objects as values and the id as key
        Type Parameters:
        T - the generic type of the value
        K - the generic type of the id of the node
        Parameters:
        treeIdNodeMap - the Map object with the TreeIdNode objects to transform
        Returns:
        a Map object with the corresponding BaseTreeNode objects
      • getRoot

        public static <T,​K> BaseTreeNode<T,​K> getRoot​(@NonNull
                                                                  @NonNull java.util.Map<K,​TreeIdNode<T,​K>> treeIdNodeMap)
        Retrieves the root BaseTreeNode object from the given @link Map} object that contains TreeIdNode objects as values and the id as key
        Type Parameters:
        T - the generic type of the value
        K - the generic type of the id of the node
        Parameters:
        treeIdNodeMap - the Map object with the TreeIdNode objects to transform
        Returns:
        the root BaseTreeNode object or null if not found