Class NestedSetUtil
java.lang.Object
com.mewebstudio.springboot.jpa.nestedset.NestedSetUtil
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 Summary
Modifier and TypeMethodDescriptionstatic <ID,E extends INestedSetNode<ID>, T extends INestedSetNodeResponse<ID>>
List<T>Build a tree structure from a list of nested set nodes.
-
Method Details
-
tree
public static <ID,E extends INestedSetNode<ID>, List<T> treeT extends INestedSetNodeResponse<ID>> (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.
-