title: Java - Creating an array of methods
body: <p>I'm designing a text-based adventure game for a school progress. I have each "level" set up as a class, and each explorable area (node) as a method within the appropriate class.</p>
  
  <p>What's messing with me is the code to move from one node to another. Because each node is connected to up to four other nodes, I have to repeat an extremely similar block of code in each method.</p>
  
  <p>What I'd prefer to do is include an array of methods at the beginning of each node, like this:</p>
  
  <pre><code>public static void zero()
  {
      ... adjacentNodes[] = {one(), two(), three(), four()};
  }
  </code></pre>
  
  <p>And then send that array to a generic method, and have it send the player to the right node:</p>
  
  <pre><code>public static void move(...[] adjacentNodes, int index)
  {
      adjacentNodes[index];
  }
  </code></pre>
  
  <p>I simplified my code, but that's the general idea. Is this possible?</p>