title: Overloading Java method with concrete variants of interface
body: <p>I have a class that has a function that I want to behave differently depending on the action, all of these concrete classes implement the <code>Action</code> class. I know due to overload being determined at runtime, Action a would not go into any of these functions. What is the correct way to do this without using instanceof?</p>
  <p>Thanks!</p>
  <pre><code>    // public State myDoAction(Action action){
      //    return myDoAction(action);
      // }
      public State myDoAction(Rest action){
          Witch newMe = me.doAction(action);
          return new State(newMe,opponent,potionsList);
      }
  
      public State myDoAction(Cast action){
          Witch newMe = me.doAction(action);
          return new State(newMe,opponent,potionsList);
      }
  
      public State myDoAction(Brew action){
          Witch newMe = me.doAction(action);
          List&lt;Brew&gt; newPotionsList = new ArrayList&lt;&gt;(potionsList);
          newPotionsList.remove(action);
          return new State(newMe,opponent,newPotionsList);
      }
  </code></pre>