JDK 13
JDK 13, is an Open Source Reference Implementation of Version 13. That is for the Java SE Platform that specified as JSR 388 in Java online course Community Process.
JDK 13, has reached General Availability as of September 17, 2019. Production – Ready, Binaries under GPL were available from Oracle, binaries with other vendors that follow shortly.
The Schedule and Features of this Release were proposed and Traced via the JEP process, as they embedded by JEP 2.0 Proposal. The Release produced by Using the JDK Release process.
Features.
355: Text Blocks
354: Switch Expressions.
353: Reimplement legacy Socket API.
351: ZGC: Uncommit Unused Memory.
350: Dynamic CDS Archives.
In the First Glance, it doesn’t look more. In fact, due to Very Short Time, from the Release of Java 12, we cannot expect too many changes. That is instead, the Releases in between Long –Term Support (LTS) versions.
They Offer certain, features as Previews in point to get early, Feedback From users. Functions were Implemented, in JEPs and soon. They reached certain Maturity, which delivered with the Next release of Defined, in a Half Yearly cycle.
This creates, impossible to predict exactly, how many latest functions are relevant to a typical Java programmer. That Includes in next Release.
Their Main Goal is to Finalize, preview Features, by Next LTS version, by that they are very stable enough. We look good for the Next 3 years. That is in September 2021, Java 17, take over Legacy of Java 11 and Java 8.
Enhancements for Switch Expressions
If you look, at the list, with a Developer point of view, it lasts two points. For example, the switch Expressions introduced as Preview in Java 12. That has extended due to user Feedback.
Switch Expressions, is the best Alternative, too cumbersome and Error-prone Switch statements. That is a Detailed Overview, where users can found in many articles of Java 12.
The best and biggest change in Java 13, is the replacement of Keyword break. That is in switch expression by Yield. The background is better differentiation, between expressions and Switch Statements.
A simple code example Follow, in the listing, We can see a statement with break fall. In comparison follows, a switch expression, with new Keyword yield and many labels.
In contrast to a variant, no variable has changed, but output result of the case, branch is Returned Directly.
Listing 1
// Switch-Statement with break
private static String statementBreak(int switchArg){
String str = "not set";
switch (switchArg){
case 1:
case 2:
str = "one or two";
break;
case 3:
str = "three";
break;
};
return str;
}
// Switch-Expression with yield
private static String expression Break With Value (int switching){
return switch (switchArg){
case 1, 2: yield "one or two";
case 3: yield "three";
Inbuilt: yield "smaller than one or bigger than three";
};
}
Listing 2
The Arrow syntax started in Java 12 still works (Listing 2).
Private static String expression With Arrow (int i) {
return switch (i) {
case 1, 2 -> "one or two";
case 3 -> "three";
Inbuilt -> "smaller than one ";
};
}
Switch Expressions will remain in preview, for time being. So, there will be no adjustments, in future Java Versions. When Compiling With JDK 13, the corresponding Flags were Specified.
javac --release 13 --enable-preview Examples.java
The View of feature is activated at startup, of course, designed tools will have configuration Switches.
Text Blocks Instead of Raw String Literals
Text Blocks were actually, as a Small part of Raw String Literals. That is originally planned for Java 12. The First Implementation of Raw string literals is not yet down to last detail, users, feedback raised so many questions.
Exact Details were found in Mailing List, Java 13, which only has multi-line text blocks for as of now. Get more info Java online training
Text Blocks Instead of Raw String Literals
These blocks actually, only a small part of Raw string Literals. Planned for Java 12. First Implementation of Raw String, Literals is not enough, through down last detail. Users Feedback has raised so many questions.
Exact details will be found in Mailing List, which is Java 13, which has multiline text blocks as of Now.