How can I return a boolean while traversing a BinaryTree recursivly and checking for a specific Node with matching Value?
Solution 1:
You are ignoring the result of your recursive calls.
Rather than doing:
checkForValue(value, current.right); // Result ignored.
checkForValue(value, current.left); // Result ignored.
return false; // Always returned.
instead do:
return checkForValue(value, current.right)
|| checkForValue(value, current.left);
This will only descend into the left branch if the right branch resulted in false.