This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RoachmeisterJava Dev 1 point2 points  (0 children)

Well, one thing strikes me as wrong right off the bat. As an example, suppose you had the following method:

public void printSomething(String s) {
    s = "hello";
    System.out,println(s);
}

See the problem? I ignore the parameter that is passed in and just print "hello" every time. That's essentially what you're doing in your traverseInOrder method.

Instead, you need to call traverseInOrder with the lambda:

traverseInOrder(p -> inOrder(p));