public class HierarichicalUtils extends Object
IHierarchialReference
sConstructor and Description |
---|
HierarichicalUtils() |
Modifier and Type | Method and Description |
---|---|
static <T extends IHierarchialReference<I>,I> |
constructTree(List<T> flatList,
Comparator<T> comparator,
T filterParent)
Construct a Tree of type List{children of type T |
child node is either a SubTree of type Tree or node T; first node represents the parent node in the sub-tree}
|
static <T extends IHierarchialReference<I>,I> |
fixBrokenTree(List<T> flatList)
Some nodes immediate parents may not be in data; but their ancestors maybe.
A break in immediate parent can cause issue; so if we are aware it can happen allow a way for a child to refer to its nearest ancestor as a parent. |
public static <T extends IHierarchialReference<I>,I> List constructTree(List<T> flatList, Comparator<T> comparator, T filterParent)
T
- as IHierarchialReference
typeI
- as any Id type like String, LongflatList
- as List of Tcomparator
- as Comparator
of TfilterParent
- as the parent to be selected (excluding the parent). If parent is nu;; then all nodes will come.List
of IHierarchialReference
public static <T extends IHierarchialReference<I>,I> void fixBrokenTree(List<T> flatList)
flatList
- as List of TCopyright © 2018. All rights reserved.