title: Create a Vector and store information within a Recursive Method in Java
body: <p><strong>EDIT</strong>
  Someone has pointed out to me that effectively I need to step down through all of my recursion to make sure I hit the end point, and then start gathering values when I go back through the stacks. I have no idea what this means.</p>
  
  <p>My goal is to build a recursive method to build a path through a maze, store that path in a Vector, and return it at the end of my recursion.</p>
  
  <p>My method runs the maze, but I am having difficulties storing the list in my Vector because I need to instantiate it every recursion.</p>
  
  <p>Here is my code(<strong>EDITED</strong>):</p>
  
  <pre><code>protected Vector&lt;GameCell&gt; findPath(int nRow, int nCol)
  {
  
      aBoard[nRow][nCol].setVisited(true);
      if(aBoard[nRow][nCol].getVal() == 'E')
      {
          Vector&lt;GameCell&gt; list = new Vector&lt;GameCell&gt;();
          list.add(aBoard[nRow][nCol]);
          return list;
      }
  
  
      if(canGoLeft(nRow, nCol))
      {
          if(!aBoard[nRow][nCol - 1].isVisited())
          {
  
              return findPath(nRow, --nCol);
          }
      }
  
      if(canGoRight(nRow, nCol))
      {
          if(!aBoard[nRow][nCol+1].isVisited())
          {
              return findPath(nRow, ++nCol);
          }
  
      }
  
      if(canGoUp(nRow, nCol))
      {
          if(!aBoard[nRow - 1][nCol].isVisited())
          {
              return findPath(--nRow, nCol);
          }
      }
  
      if(canGoDown(nRow, nCol))
      {
          if(!aBoard[nRow + 1][nCol].isVisited())
          {
              return findPath(++nRow, nCol);
          }
      }
  
      System.out.println("You hit a dead end.");
      return null;
  
  }
  </code></pre>
  
  <p>Is there a way I can not instantiate my Vector every recursion so I can store my values permanently?</p>
  
  <p>Any help would be greatly appreciated.</p>