public class TreeSorter extends Object
Constructor and Description |
---|
TreeSorter() |
Modifier and Type | Method and Description |
---|---|
static <T> List<T> |
depthFirstPreOrderSort(Collection<T> unsorted,
com.google.common.base.Function<T,List<T>> ancestorsGetter,
Comparator<T> tComparator)
Converts collections of objects with parent-child relationships into a list sorted as a flattened tree, traversed
depth-first with pre-order.
|
public static <T> List<T> depthFirstPreOrderSort(Collection<T> unsorted, com.google.common.base.Function<T,List<T>> ancestorsGetter, Comparator<T> tComparator)
unsorted
- an unsorted collection of objects with a parent-child relationshipancestorsGetter
- a function returning an object's ancestors with the root at the start. May return an empty list
but never null.tComparator
- compares two sibling objects in the treeCopyright © 2003–2015 Atlassian. All rights reserved.