title: Replacing switch statement Java
body: <p>I've been wondering if there is a way for me to replace the current switch statement I have. Below is an example of the code I have, although the statement I have is a lot longer and will only get larger. The switch method gets called through a file reader so it reads a line then calls this function with values assigned. </p>
  
  <pre><code>public static void example(String action, String from, String to){
   switch (action) {
             case ("run"):
                  runTo(from,to);
                  break;
             case ("walk"):
                  walkTo(from,to);
                  break;
             case ("hide"):
                  hideAt(to);
                  break;
              }
   }
  </code></pre>
  
  <p>edit:
  I was curious if there is a better way instead of using a switch statement like the above scenario.</p>
  
  <p>I've updated the example a bit to make a little more sense. Some of the method calls dont need to use all of the parameters.</p>