title: Is it faster to use a switch statement vs an if statement, or put the cases inside a hashMap and just use the contains method?
body: <p>I currently have this very long if statement:</p>
  
  <pre><code>if (somesTring != null &amp;&amp; !"".equals(somestring)
    SomeClass.doSomething();
  else if (somesTring != null &amp;&amp; !"".equals(somestring)
    SomeClass.doAnother();
  ...
  else
    SomeClass.giveUp();
  </code></pre>
  
  <p>I think this would execute poorly when the item in question is at the bottom of the decision tree. I'm considering the switch statement, which, according to my coworker, is faster. The sad thing is that the comparisons are performed with strings, which is not supported by the switch statement. Maybe I can get the hashcodes of the strings involved and use that for the switch statement.</p>
  
  <p>I'm also considering a hashmap that contains each of those strings and make decisions with the help of the containsKey method. This, however, involves having to slice up a class that contains a lot of static methods and make each of those methods as a somewhat executable object. By doing this, I can dispose of the very large "if" statement.</p>
  
  <p>Which of the said approaches make more sense with regards to execution time, good practice, and maintainability? Other suggestions are welcome :)</p>