title: Printing Paths for Trees
body: <pre><code>   static void printAllPathsFromRootToLeaf (BinaryTree&lt;Integer&gt; tree, ArrayList&lt;Integer&gt; path)
  {
      if (tree.isEmpty())
      {
          System.out.println("Tree is Empty");
          return;
      }
      path.add(tree.root());
  
      if (tree.left().isEmpty() &amp;&amp; tree.right().isEmpty())
      {
          System.out.println(path);
          printSum(path);
          //return;
      }
      else
      {
          printAllPathsFromRootToLeaf(tree.left(),new ArrayList(path));
          printAllPathsFromRootToLeaf(tree.right(),new ArrayList(path));
      }
  }
  </code></pre>
  
  <p>When print the path it only prints the last path or it only prints one path in my tree. Would anyone know why?? </p>
  
  <p>THANK YOU! </p>