JEP 406 targets #Java17, which means we can start using pattern matching with `switch` (as preview)! 🥳 Here's how that's gonna work. 🧵 (For this thread to make sense, you need to know type patterns. If you don't: or nipafx.dev/java-type-patt…) 1/10
JEP 406 targets #Java17, which means we can start using pattern matching with `switch` (as preview)! 🥳 Here's how that's gonna work. 🧵 (For this thread to make sense, you need to know type patterns. If you don't: or nipafx.dev/java-type-patt…) 1/10 https://t.co/YE0NbSvCZq
Q: What can I do with this that I can't do with `if`? A: Nothing (as is generally the case for `switch`). But you can _express_ that you expect _exactly one_ of the branches to be executed. Benefits: better readability, less room for errors, compiler support, performance. 2/10