title: Java return boolean true using recursion
body: <p>I am trying to see if a value is contained in my Binary Search Tree, and I am traversing the tree using recursion. The problem is the function returns false as the last value on the call stack instead of true.</p>
  
  <p>Here is pseudo code:</p>
  
  <pre><code>public boolean containsValue(Node node, Value v) {
  
     if (node.value.equals(v)) {
       return true;
     } 
     containsValue(node.left, v); // &lt;- search left tree
     containsValue(node.right, v); // &lt;- search right tree
  
     return false;
  }
  </code></pre>
  
  <p>This always returns false.</p>
  
  <p>However I can't do this because the second return statement is dead code:</p>
  
  <pre><code> return containsValue(node.left, v);
   return containsValue(node.left, v);
  </code></pre>
  
  <p>So how would I fix this?</p>