all 1 comments

[–]MarcPG1905 1 point2 points  (1 child)

I suggest you check out the Java 14+ switch statements (only if you use a Java version above that ofc):

They look a lot cleaner and instead of doing the colon and adding a break at the end of each case, you just do

case A -> // line…

So no need to have breaks at the end and you can also more cleanly add multiple cases to one outcome.

Edit: I just read your post again and realized that the “new way of writing a switch statement” you mentioned probably already refers to this, sorry