Home >Java >javaTutorial >What are the new features of jdk8
New features in JDK 8 include: introducing Lambda expressions, providing Stream API, enabling client TLS 1.2, supporting AEAD algorithm, higher security, new Modena theme, new packages, etc.
What's new in JDK 8
Java Platform, Standard Edition 8 is a feature-rich major release. This document summarizes the features and enhancements in Java SE 8, JDK 8, and Oracle's implementation of Java SE 8. Click a component name for a more detailed description of the component's enhancements.
Java Programming Language
Lambda expressions are a new language feature that has been introduced in this version. This feature allows you to treat functions as method parameters, or code as data. Using lambda expressions, you can more concisely represent instances of single-method interfaces (called functional interfaces).
Method references provide easy-to-understand lambda expressions for methods that already have names.
The default method allows new functionality to be added to the library's interfaces and ensures binary compatibility with code written for older versions of these interfaces.
Duplicate annotations support multiple applications of the same annotation type to the same statement or type usage.
Type annotations support applying annotations anywhere a type is used, not just declarations. When combined with the pluggable type system, this feature improves type checking of your code.
Improved type inference.
Method parameter reflection.
Collection
The new java.util.stream class in the package provides a Stream API that supports Streams of elements perform functional operations. The Stream API is integrated into the Collections API and can perform batch operations on collections, such as sequential or parallel map-reduce transformations.
Performance improvements for HashMap with key conflicts
Compact profile
Includes Java SE A predefined subset of the platform and supports applications that do not require the entire platform to be deployed and run on small devices.
Security
Client TLS 1.2 is enabled by default
New changes to AccessController.doPrivileged Body supports code asserting a subset of its permissions without preventing a full stack traversal to check for additional permissions
Stronger password-based encryption algorithm
JSSE server-side support for SSL/TLS Server Name Indication (SNI) extension
Support for AEAD algorithm: The SunJCE provider has been enhanced to support AES/GCM/NoPadding cipher implementations as well as GCM Algorithm parameters. The SunJSSE provider has also been enhanced to support AEAD mode-based cipher suites. See Oracle Provider Documentation, JEP 115.
Keystore enhancements, including new domain keystore type java.security.DomainLoadStoreParameter and new command option -importpassword
JavaFX
The WebView class contains new features and improvements. For more information about other HTML5 features, including web sockets, web workers, and web fonts, see HTML5 Supported Features.
Enhanced text support, including bidirectional text, complex text scripts (such as Thai and Hindi controls), and multi-line, multi-style text in text nodes.
This version adds support for Hi-DPI display.
CSS Styleable* classes have become public API. For more information, see the Javafx.css javadoc.
The new ScheduledService class allows automatic restart of services.
JavaFX is now available for the ARM platform. The JDK for ARM includes the base, graphics, and control components of JavaFX.
Tools
The Nashorn engine can be called through the jjs command.
java command is used to start JavaFX applications.
Rewritten the java man page.
Class files can be analyzed through the jdeps command line tool.
Java Management Extensions (JMX) supports remote access to diagnostic commands.
The jarsigner tool provides an option to request a signed timestamp from a Timestamp Authority (TSA).
Javac Tool
#The -parameters option of the javac command can be used to store formal parameter names and enable the reflection API to Retrieve formal parameter names.
The javac command now correctly implements the type rules for equality operators in Java Language Specification (JLS) section 15.21.
Thejavac tool now supports checking the content of javadoc comments, thus avoiding various problems in the files generated when running javadoc, such as invalid HTML or accessibility issues. This feature can be enabled via a new Xdoclint option. See the output when running "javac -X" for more details. This feature is also available in the javadoc tool and is enabled by default.
javac tool now supports generating native headers on demand. This eliminates the need to run the javah tool separately in the build pipeline. This feature can be enabled in javac using the new -h option, which specifies the directory to which header files are written. A header file will be generated for annotated constant fields for any class that has a native method or uses a new annotation of type java.lang.annotation.Native .
Javadoc Tool
The javadoc tool supports the new DocTree API, allowing you to treat Javadoc comments as abstract syntax trees to traverse.
The javadoc tool supports the new Javadoc Access API, which allows you to call Javadoc tools directly from your Java application without executing a new process. For more information, see the javadoc new features page.
The javadoc tool now supports checking the content of javadoc comments, thus avoiding various problems in the files generated when running javadoc, such as invalid HTML or accessibility issues. This feature is enabled by default and can be controlled with the new -Xdoclint option. See the output when running "javadoc -X" for more details. The javac tool also supports this feature, but it is not enabled by default.
Internationalization
Unicode enhancements, including support for Unicode 6.2.0
Using Unicode CLDR data and java.locale.providers system properties
New calendar and locale API
Support Custom resource bundles are installed as extensions
Deployment
Date-Time Package
A set of new packages that provide a comprehensive date-time model.Scripting
The Rhino Javascript engine has been replaced by the Nashorn JavaScript enginePack200
IO and NIO
Improved the performance of java.lang.String(byte[], *) constructor and java.lang.String.getBytes() method.
java.lang and java.util packages
Parallel array sorting
Standard encoding and decoding Base64
Unsigned arithmetic support
JDBC
Removed JDBC-ODBC Bridge.
JDBC 4.2 introduces new features.
Java DB
JDK 8 includes Java DB 10.10.
Network
The java.net.URLPermission class has been added.
In the java.net.HttpURLConnection class, if a security manager is installed, the call requesting to open the connection requires permissions.
Concurrency
Some new classes and interfaces have been added to the java.util.concurrent package.
Some new methods have been added to the java.util.concurrent.ConcurrentHashMap class to support aggregation operations based on new stream tools and lambda expressions.
The java.util.concurrent.atomic package has added new classes to support extensible and updatable variables.
Some new methods have been added to the java.util.concurrent.ForkJoinPool class to support universal pools.
The new java.util.concurrent.locks.StampedLock class provides a capability-based lock that can control read/write access through three modes.
Java XML - JAXP
HotSpot
New Hardware intrinsics to use Advanced Encryption Standard (AES). The UseAES and UseAESIntrinsics flags enable hardware-based AES intrinsics for Intel hardware. Hardware must be 2010 or newer Westmere hardware. For example, to enable hardware AES, use the following flags:
-XX: UseAES -XX: UseAESIntrinsics
To disable hardware AES, please use the following flags:
-XX:-UseAES -XX:-UseAESIntrinsics
Removed PermGen.
The bytecode instructions called by the method support the default methods in the Java programming language.
Java Mission Control 5.3 Release Notes
JDK 8 includes Java Mission Control 5.3.
The above is the detailed content of What are the new features of jdk8. For more information, please follow other related articles on the PHP Chinese website!