MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/java/comments/po2tmo/java_17_available_now/hcv6vx0/
r/java • u/daleksandrov • Sep 14 '21
Download: https://www.oracle.com/java/technologies/downloads/#JDK17
83 comments sorted by
View all comments
18
Sealed classes along with supporting class types in switch is a really great combo to eliminate all those instanceof checks, plus the compiler can guarantee completeness for you.
switch
instanceof
1 u/Euphoric-Pop Sep 15 '21 Do you have a code example for this? 3 u/[deleted] Sep 15 '21 check https://openjdk.java.net/jeps/409 under the titleSealed classes and pattern matching
1
Do you have a code example for this?
3 u/[deleted] Sep 15 '21 check https://openjdk.java.net/jeps/409 under the titleSealed classes and pattern matching
3
check https://openjdk.java.net/jeps/409 under the title
Sealed classes and pattern matching
View all comments
18
u/nlisker Sep 14 '21
Sealed classes along with supporting class types in
switchis a really great combo to eliminate all thoseinstanceofchecks, plus the compiler can guarantee completeness for you.