Advice on tree transversals

Jose jgetino at
Thu Mar 28 12:57:26 PDT 2013

I'd like to know if there is any chance of lambdifing tree transversals and

For example, a make a depth first transversal with a recursive call like

void  depthFirstVisit(Visitor visitor, VisitMode visitMode) {
        if (visitMode == VisitMode.PRE_ORDER) {
         for (Node<D> child : getChildren()) {
         if (visitMode == VisitMode.POST_ORDER) {
	   return list;
I would like to get rid off the visitor's pattern and replace it with
filters/consumers, which seems not a big deal. But the final goal would be
to replace the transversal code with an appropriate pipeline, which means
decoupling the stream creation from the stream processing. 

I feel I should be simple enough, parallelism is not a concern here, but I
don't see how to generate the tree node stream.  


More information about the lambda-dev mailing list