Java: If vs. Switch

Don’t worry about performance; use the syntax that best expresses what you’re doing. Only after you have (a) demonstrated a performance deficiency; and (b) localized it to the routine in question, only then should you worry about performance. For my money, the case syntax is more appropriate here.

Leave a Comment