filmov
tv
Java 14 new Features | All Java JDK 14 new features at glance
Показать описание
Lis of Java 14 New Features.
Pattern Matching for instanceof (Preview)
Text Blocks (Second Preview)
Records (Preview)
Helpful NullPointerExceptions
Switch Expressions (Standard)
Packaging Tool (Incubator)
Foreign-Memory Access API (Incubator)
Non-Volatile Mapped Byte Buffers
JFR Event Streaming
NUMA-Aware Memory Allocation for G1
Remove the Concurrent Mark Sweep (CMS) Garbage Collector
Remove the Pack200 Tools and API
Pattern Matching for instanceof (Preview):
instanceof conditions throughout the code. Specifically, an instanceof conditional check is generally followed by a typecasting.
Java 14, gets rid of this verbosity by making conditional extraction a lot more concise.
Text Blocks (Second Preview):
This is a preview feature. It allows us to create multiline strings easily. The multiline string has to be written inside a pair of triple-double quotes.
The string object created using text blocks has no additional properties. It’s an easier way to create multiline strings. We can’t use text blocks to create a single-line string.
The opening triple-double quotes must be followed by a line terminator.
Switch Expressions Enhancements (Preview):
Switch expressions were added as a preview feature in Java 12 release. It’s almost same in Java 13 except that the “break” has been replaced with “yield” to return a value from the case statement.
Packaging Tool (Incubator):
Create a simple packaging tool, based on the JavaFX javapackager tool, that:
Supports native packaging formats to give end users a natural installation experience. These formats include msi and exe on Windows, pkg and dmg on macOS, and deb and rpm on Linux.
Allows launch-time parameters to be specified at packaging time.
Can be invoked directly, from the command line, or programmatically, via the ToolProvider API.
Helpful NullPointerExceptions:
Null Pointer Exceptions are a nightmare for any developer. Previously, until Java 13, it was tricky to debug the infamous NPEs. Developers had to fall onto other debugging tools or manually figure the variable/method that was null since the stack trace would only show the line number.
Records:
A record is a data class that stores pure data. The idea behind introducing records is to quickly create simple and concise classes devoid of boilerplate code.
Normally a class in Java would require you to implement equals(), hashCode() , the getters and setters methods. While some IDEs support auto-generation of such classes, the code is still verbose. With a record you need to simply define a class in the following way.
#JavaBeam #Java14NewFeatures #Java
Pattern Matching for instanceof (Preview)
Text Blocks (Second Preview)
Records (Preview)
Helpful NullPointerExceptions
Switch Expressions (Standard)
Packaging Tool (Incubator)
Foreign-Memory Access API (Incubator)
Non-Volatile Mapped Byte Buffers
JFR Event Streaming
NUMA-Aware Memory Allocation for G1
Remove the Concurrent Mark Sweep (CMS) Garbage Collector
Remove the Pack200 Tools and API
Pattern Matching for instanceof (Preview):
instanceof conditions throughout the code. Specifically, an instanceof conditional check is generally followed by a typecasting.
Java 14, gets rid of this verbosity by making conditional extraction a lot more concise.
Text Blocks (Second Preview):
This is a preview feature. It allows us to create multiline strings easily. The multiline string has to be written inside a pair of triple-double quotes.
The string object created using text blocks has no additional properties. It’s an easier way to create multiline strings. We can’t use text blocks to create a single-line string.
The opening triple-double quotes must be followed by a line terminator.
Switch Expressions Enhancements (Preview):
Switch expressions were added as a preview feature in Java 12 release. It’s almost same in Java 13 except that the “break” has been replaced with “yield” to return a value from the case statement.
Packaging Tool (Incubator):
Create a simple packaging tool, based on the JavaFX javapackager tool, that:
Supports native packaging formats to give end users a natural installation experience. These formats include msi and exe on Windows, pkg and dmg on macOS, and deb and rpm on Linux.
Allows launch-time parameters to be specified at packaging time.
Can be invoked directly, from the command line, or programmatically, via the ToolProvider API.
Helpful NullPointerExceptions:
Null Pointer Exceptions are a nightmare for any developer. Previously, until Java 13, it was tricky to debug the infamous NPEs. Developers had to fall onto other debugging tools or manually figure the variable/method that was null since the stack trace would only show the line number.
Records:
A record is a data class that stores pure data. The idea behind introducing records is to quickly create simple and concise classes devoid of boilerplate code.
Normally a class in Java would require you to implement equals(), hashCode() , the getters and setters methods. While some IDEs support auto-generation of such classes, the code is still verbose. With a record you need to simply define a class in the following way.
#JavaBeam #Java14NewFeatures #Java