Class NestedSetUtil

java.lang.Object
com.mewebstudio.springboot.jpa.nestedset.NestedSetUtil

public class NestedSetUtil extends Object
Utility class for working with nested set trees. This class provides methods to build a tree structure from a list of nested set nodes.
  • Method Details

    • tree

      public static <ID, E extends INestedSetNode<ID, E>, T extends INestedSetNodeResponse<ID>> List<T> tree(List<E> nodes, Function<E,T> convert)
      Build a tree structure from a list of nested set nodes.
      Type Parameters:
      ID - Type of the node identifier.
      E - Type of the nested set node.
      T - Type of the response node.
      Parameters:
      nodes - List of nested set nodes.
      convert - Function to convert a node to its response type.
      Returns:
      List of top-level nodes with their children.