In JEP 456 a little enhancement will come for case label:
var x = 42;
switch (box) {
case Box(RedBall _), Box(BlueBall _) when x == 42 -> processMatchAllBox(box); // multiple patterns introduce in JDK 22
case Box(RedBall _) when x == 21, Box(BlueBall _) -> processBox(box);
case Box(GreenBall _) -> stopProcessing();
case Box(_) -> pickAnotherBox();
}
In JEP 456 a little enhancement will come for
caselabel: