Idk, maybe y’all are working on projects where that makes sense. I can’t imagine what those would be but if it works for you and you think it’s a 1000x better - more power to you!
Sealed interface switches are a direct replacement for the visitor pattern, so it just depends on how many places you have where you have a small set of types and a lot of operations on those types.
Totally, I think you nailed it down. I don’t think that an average Java project has enough of those to justify a language change, obviously the committee overseeing Java development disagrees and based on the comments and a lot of Java devs disagree with me too, which is totally cool.
View all comments
Show parent comment
-1
u/narrow-adventure Feb 17 '26
Idk, here is a hot take: if you’re writing so many switches that your code is a 1000x better in Java 25 you were miss organizing your code.
Look into replacing switches with the adapter pattern, just my 2 cents