private static <T> Stream.Builder<? extends T> walk(
            T first,
            UnaryOperator<T> traverser,
            WalkingOrder order, 
            Stream.Builder<T> builder) {
        
        requireNonNulls(first, traverser, order, builder);
        
        if (order == WalkingOrder.FORWARD) {
            builder.add(first);
        }
        
        final T next = traverser.apply(first);
        if (next != null) {
            walk(next, traverser, order, builder);
        }
        
        if (order == WalkingOrder.BACKWARD) {
            builder.add(first);
        }
        
        return builder;
    }
The walking order of the tree.
runtime-parent/runtime-config/src/main/java/com/speedment/runtime/config/internal/util/Trees.java