asSequence

fun <T> TreeNode<T>.asSequence(order: TreeNodeIterators = TreeNodeIterators.PreOrder): Sequence<TreeNode<T>>(source)

Lazily traverses this subtree in the given order as a Sequence, without forcing the whole traversal up front. Pairs with the Kotlin stdlib, e.g. root.asSequence().map { it.value }.firstOrNull { it == target }.