Class TreeHelper
java.lang.Object
ch.tocco.nice2.optional.qualification.impl.util.entities.TreeHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic <I,R> Optional <R> findInRoot(I input, Function<I, R> dataFunction, Function<I, I> parentFunction) tries to load data for some input, and falls back up the tree if nothing could be found
-
Method Details
-
findInRoot
public static <I,R> Optional<R> findInRoot(I input, Function<I, R> dataFunction, Function<I, I> parentFunction) tries to load data for some input, and falls back up the tree if nothing could be found- Type Parameters:
I- the class of the nodesR- the class of the data- Parameters:
input- the starting nodedataFunction- a function that loads some dataparentFunction- a function the loads the parent of a node- Returns:
- an Optional containing the first non-null value in the tree
-