collect

inline fun <T : Node> collect(crossinline condition: (T) -> Boolean): List<T>

Collects the visited nodes of type T into a collection, as long as they satisfy a condition.

Return

an ordered list (DFS order) containing all the visited nodes of type T in the tree

Parameters

condition

condition to be satisfied for the node to be collected

T

node type