Java 12, which is released in March 209, focuses on developments related to the internals operations of the JDK, with few additional features will have a real impact on Java developers on a daily basis.
One feature that can make a big impact on Java developers is the extension of switch expressions in Java 12. This new feature is in preview language feature, so it’s not finalized and not enabled by default. But there are more things that comes with the release of JDK 12.
In this series we will look at the features and changes in Java 12.
Blogs in this series:
Java 12 FeaturesWhat are the features and enhancements in Java 12, and how will it be different from previous version and the change on the way we code. This post is basically a very short summary of each JEP as documented for JDK 12.
Tutorials in this series:
Java 12 - Switch Expressions (JEP 325)Java 12 extends the switch statement so that it can be used either as a statement or as an expression (JEP 325). In this article we will learn how the new syntax case L -> simplified the control flow, and how to use it in our development.
Java 12 - New Methods in StringJava 12 added various new methods in java.lang.String. They are: indent(), transform(), and methods related to JVM Constants API: describeConstable() and resolveConstantDesc().
Java 12 - CompactNumberFormat ExamplesJava 12 introduced a new class, CompactNumberFormat. This is a subclass of NumberFormat that formats a decimal number in a compact form. An example of a SHORT compact form would be writing 1,000,000 as 1M, only requiring two instead of seven characters.
Java 12 - Stream API Collectors.teeing()Intoduced in Java 12, Collectors.teeing() method allows to collect a Stream using two independent collectors, and then merge their results using the supplied BiFunction.
Java 12 - Use Files.mismatch() to Compare FilesJDK 12 introduces a new method to the Files class. The method mismatch(Path, Path) compares the two specified files and returns the index of the first byte where they differ or -1 if they don’t.
Java 12 - Exception Handling in CompletionStage (CompletableFuture)CompletableFuture is a class that implemented CompletionStage interface. CompletionStage now include several overloaded forms of new methods for exception handling: exceptionallyAsync(), exceptionallyCompose(), and exceptionallyComposeAsync().
Build OpenJDK 12 On Fedora 29Since Java JDK is opensource, we can create for ourself a custom build of OpenJDK. In this article, I'll I attempt to perform custom build for OpenJDK in Linux Fedora 29. The Fedora has "Development Tools" ready installed.