3 ms·
With JDK 18 you even get binding patterns in matches, so you can extract + assign "Point.x"/"Point.y" to variables when matching on them!
by gavinray 5y ago
With JDK 18 you even get binding patterns in matches, so you can extract + assign "Point.x"/"Point.y" to variables when matching on them!
- Twisol 5y agoType patterns [1] are still unfortunately in preview (and have been since JDK 17), and record (destructuring) patterns [2] haven't even landed as a preview yet. I hope the latter get at least a preview in JDK 19 [3], but it looks like they've barely even begun the process of targeting JEPs to 19 yet. [1]: https://openjdk.java.net/jeps/420 https://openjdk.java.net/jeps/420 [2]: https://openjdk.java.net/jeps/405 https://openjdk.java.net/jeps/405 [3]: https://openjdk.java.net/projects/jdk/19/ https://openjdk.java.net/projects/jdk/19/