Possible Duplicates:
Is "else if" faster than "switch() case"?
What is the relative performance difference of if/else versus switch statement in Java?
I know that case statements can be implemented with jump tables. Does this make them more efficient than if statements?
Is this just micro-optimization that should be avoided?
I think the main thing is to write the code as clearly as possible. Micro-optimizations like this shouldn’t be the focus.
For example, if you have something like this:
Then it’s clearer to use a switch statement:
Again, I would focus on making the code easiest to read and maintain rather than nano-second level efficiency gains.