4 ms·
I'm happy that JEP 441 was added to Java. // As of Java 21 Integer i = ... switch (i) { case -1, 1 -> ... // Special case
by wdroz 3y ago
I'm happy that JEP 441 was added to Java.
// As of Java 21
Integer i = ...
switch (i) {
case -1, 1 -> ... // Special cases
case Integer j when j > 0 -> ... // Positive integer cases
case Integer j -> ... // All the remaining integers
}
I should stop to talk badly of Java based on my old memories of Java 6... Maybe they should do like C++ and call it modern Java.