case-statement or if-statement efficiency perspective [duplicate]
问题 This question already has answers here : Closed 9 years ago . 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? 回答1: I think the main thing is to write the code as clearly as possible. Micro-optimizations like this