Oracle’s move towards a faster release cycle means that more features and abilities are coming our way, faster than ever before.The Java 11 launch date is scheduled for September 2018, and the repository is currently open for bug fixes, as well as propositions for more JDK Enhancement Proposals (JEP) to be added to the upcoming version.
- Local-Variable Syntax for Lambda Parameters (JEP 323)
- Epsilon: An Arbitrarily Low-Overhead Garbage Collector (JEP 318)
- Dynamic Class-File Constants (JEP 309)
- Remove the Java EE and CORBA Modules (JEP 320)
Java 11 will include more than just features
While this feature list is still not final and we’re expecting more JEPs to be added in the following months, Java 11 will have a little something extra. One of the main highlights that will come with Java 11, is long-term support of the platform. To understand what it means, let’s take a trip back to September 2017, when According to Oracle Java SE Support Roadmap Oracle is moving to long-term support (LTS) model for their Java SE products. This image will give you the clear idea Source: Oracle (Through https://medium.com/codefx-weekly)
Other Changes in the existing classes:
1. New String Methods
There are a few methods that have been added as part of JDK 11 and helps developers to minimize coding efforts.
strip()
This method is used to remove the leading and trailing whitespace. It is helpful to remove the white space from the beginning and end of a string.
stripLeading()
This method is used to remove the white space from the beginning of a string.
stripTrailing()
This method is used to remove the white space from the end of a string.
isBlank()
This method returns true if the string is empty or contains only white spaces; otherwise, it returns false.
lines()
This method is used to return the stream of strings that are partitioned by line terminators. The lines in the stream are in the order in which they occur in the string. This method will give more performance as compared to the methods we are using currently.
repeat(n)
This method will return the concatenated string, and the number of times it will concatenate is dependant upon the count that we supply as an argument to this method.
2. Files Utility Methods
writeString()
This method is used to write the contents to a file. Characters are encoded into bytes using the specified charset, and the default value is a UTF-8 charset.
readString()
This method will read all contents from a file into a string, decoding from bytes to characters using the UTF-8 charset. The method also ensures that the file is closed when all content has been read or an I/O error, or other runtime exception, is thrown.
isSameFile()
This method is used for tests if two paths locate the same file or not. This method returns true if two path objects are equal without even checking the file existence.
Pattern With Predicate Utility Methods
3. MatchPredicate
We had the asPredicate() method as part of JDK 8, which will create a predicate if this pattern is found in a given string. In JDK 11, the new method asMatchPredicate() has been introduced and will create a predicate if this pattern matches a given input string.
Keep visiting for more exciting updates on Java and related technologies.
Comments
Post a Comment