3 ms·
Java is also getting switch expressions next month (as a preview feature in JDK 12): https://openjdk.java.net/jeps/325 https://openjdk.java.net/jeps/325
by pron 8y ago
Java is also getting switch expressions next month (as a preview feature in JDK 12): https://openjdk.java.net/jeps/325 https://openjdk.java.net/jeps/325
- chvid 8y agoIt is exactly the same isn't it?
- dmitriid 8y agoIt's not. C#'s switch can pattern match on value and type: https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-with-patterns-in-c-8-0/ https://blogs.msdn.microsoft.com/dotnet/2019/01/24/do-more-w... Java's switch still operates only on String, int, short, byte, char, and their wrapper types: https://blog.codefx.org/java/switch-expressions/ https://blog.codefx.org/java/switch-expressions/