public class TreeUtils extends java.lang.Object
Constructor and Description |
---|
TreeUtils() |
Modifier and Type | Method and Description |
---|---|
static <T,K> T |
createTree(java.util.Set<java.util.List<K>> paths,
ITreeNodeHandler<T,K> handler)
This method creates a tree from a set of paths.
|
static <T> T |
createTreeFromStrings(java.util.Set<java.lang.String> paths,
java.lang.String separator,
ITreeNodeHandler<T,java.lang.String> handler)
Utility method for creating a tree from paths described by strings.
|
public TreeUtils()
public static <T,K> T createTree(java.util.Set<java.util.List<K>> paths, ITreeNodeHandler<T,K> handler)
T
- the node type to be createdK
- the key type used by the nodespaths
- a set of paths where each path is a list of path elements
(keys)handler
- the handler used for creating the tree.ITreeNodeHandler.createRoot()
is always returned, even if
the set of paths is empty.public static <T> T createTreeFromStrings(java.util.Set<java.lang.String> paths, java.lang.String separator, ITreeNodeHandler<T,java.lang.String> handler)
T
- the node type to be createdpaths
- a set of paths where each path is described by a path
expression string, e.g. node1/node2/node3separator
- regular expression that defines the separator between path
elements.handler
- the handler used for creating the tree.ITreeNodeHandler.createRoot()
is always returned, even if
the set of paths is empty.