4 ms·
Even in Java, you can always use a switch based on enums or even int constants. The only thing missing would be exhaustiveness checking, but the other claims ab
by pkolaczk 6y ago
Even in Java, you can always use a switch based on enums or even int constants. The only thing missing would be exhaustiveness checking, but the other claims about extensibility or readability made in the article still hold.
- alboy 6y ago>The only thing missing would be exhaustiveness checking Not if you're on a recent version of Java, switch expressions are exhaustive and they're a stable (non-preview) feature now as of Java 14.