public class TreeSorter extends Object
|Constructor and Description|
|Modifier and Type||Method and Description|
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 relationship
ancestorsGetter- 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 tree
Copyright © 2003–2016 Atlassian. All rights reserved.