0% found this document useful (0 votes)
43 views4 pages

Java 11-17 New Features Overview

The document outlines the new features introduced in Java from version 8 to 17, highlighting key enhancements such as functional programming, the module system, reactive streams, and various API improvements. Each version includes specific features, with Java 11 being a long-term support (LTS) release that brought significant changes like new string methods and a new HTTP client. Additionally, it notes deprecated and removed features across versions, emphasizing the evolution of Java towards modern programming practices.

Uploaded by

Suresh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views4 pages

Java 11-17 New Features Overview

The document outlines the new features introduced in Java from version 8 to 17, highlighting key enhancements such as functional programming, the module system, reactive streams, and various API improvements. Each version includes specific features, with Java 11 being a long-term support (LTS) release that brought significant changes like new string methods and a new HTTP client. Additionally, it notes deprecated and removed features across versions, emphasizing the evolution of Java towards modern programming practices.

Uploaded by

Suresh
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

Java New Features

Java 8 Features
Functional Programming
Lambda Expressions
Functional Interfaces
Method References
Default Methods
Stream API
New Date/Time

Java 9 Features

JShell - REPL (Read Evaluate Process Loop)


Factory Methods for Immutable List, Set and Map - of()
Private Methods in Interfaces
Try with Resources Enhancements
Stream API Enhancements - takeWhile(), dropWhile()

Module System (Project JigSaw)

Modularise the application into modules. Promotes reusability and


simplifies custom development and deployment

Every module has module descriptor and can be build as separate


JAR file for deployment

Module Descriptor - [Link]


exports <package-name>
exports <package-name> to <mod-name>
requires <mod-name>
provides <service-name> with <service-impl-name>
uses <service-name>
opens <package-name>

Reactive Streams (Specification)

Asynchronous processing with non-blocking back pressure

Reactive Manifesto
Responsive
Resilient
Elastic
Message Driven

Reactive Stream Specification

Publisher
subscribe()

Subscriber
onSubcribe
onNext
onError
onComplete
Subscription
request()
cancel()

Processor

Reactive Stream Implementation

Project Reactor => Spring WebFlux


Mono, Flux
- map, sort, filter, distinct
Subscriber

[Link] => Java 9

RxJava => RxJava 2 (ReactiveX)

Java 10 Features
Local Variable Type Inference
Optional Enhancements - orElseThrow()
Collection Enhancements - copyOf() factory method
Stream API Enhancements - Collectors can return unmodifiable collection

Java 11 Features [LTS]


Compile Free Launch -> Launching Single File Source Code Program
var in Lambda -> (@NotNull var a, @NotEmpty var b) -> a + b
Optional isEmpty support
Not Predicate
Collection - toArray() default method

New methods in String - lines, isBlank, strip, stripTrailing,


stringLeading, repeat

New Files and Path methods - writeString(), readString()


New HttpClient

Other Features - ASCII, UTF 8, UTF 16, UTF 32


Unicode 1-9/10 Support -> 12k+ characters
Nest Based Access Control
ZGC (Experimental) - Low Latency Garbage Collector
Epsilon - No-op Garbage Collector
Low Overhead Heap Profiling

Removed Features
Applets
Java Web Start
JavaFX moved out of JDK -> [Link]
Java EE and CORBA modules

Java 12 Features
String class new method - intent(), transform()
New File mismatch method - mismatch() => -1, N
Stream Enhancement - [Link](downstream1, downstream2,
merger)
CompactNumberFormat
Preview Features
Switch Expression
Pattern Matching for instanceOf
Other Features
Unicode 11 Support
JVM Constants API
Micro Benchmark Suite
Default CDS Archive => Reduce Start Time and Memory
Footprint

Java 13 Features

NIO - ByteBuffer Enhancements - bulk get/put

Preview Features
Switch Expression
Text Block

Other Features
Legacy Socket API Reimplemented
Unicode 12 Support
Dynamic CDS Archive
CDS Enhancements

Java 14 Features

Switch Expression

Preview Features
Text Block
Pattern Matching for instanceOf
Records

Other Features
Helpful NullPointerException

Deprecated / Removed Features


CMS Garbage Collector
ParallelScavenge + SerialOld GC Combination
Solarix and SPARC ports

Java 15 Features
Text Blocks

Preview Features
Pattern Matching for instanceOf and typeChecks
Records
Sealed Classes

Other Features
Hidden Classes
ZGC and Shenandoah Garbage Collectors

Deprecated / Removed Features


Javascript Nashhorn Engine

Java 16 Features

Stream Enhancement - toList()

Preview Features
Pattern Matching for instanceOf and typeChecks
Records
Sealed Classes

Java 17 Features (LTS)

Pattern Matching
Switch Expression
Records

Sealed Classes

Preview / Incubating Features


Pattern Matching for Switch
Foreign Function and Memory API
Vector API

Other Features
Restore Always-Strict Floating-Point Semantics - strictfp
Enhanced Pseudo-Random Number Generators
New macOS Rendering Pipeline => OpenGL -> Metal API
macOS/AArch64 Port => Intel (AMD64) => M1/M2 (ARM64)
Strongly Encapsulate JDK Internals => -illegal-access
Context-Specific Deserialization Filters
LTS Release Cycle reduced to two years

Deprecated / Removed Features


Deprecate the Applet API for Removal
Remove RMI Activation
Remove the Experimental AOT and JIT Compiler
Deprecate the Security Manager for Removal

Common questions

Powered by AI

The module system introduced in Java 9, known as Project Jigsaw, significantly impacted software development and deployment by allowing developers to modularize applications. This modularization promotes reusability of code and simplifies custom development and deployment. Each module has a descriptor, allowing applications to be built as separate JAR files. This enhances the maintainability and scalability of applications by reducing the complexity associated with monolithic applications .

The enhancements to Java's HttpClient in Java 11 provide support for modern web applications through improved performance, ease of use, and asynchronous operation. The new HttpClient API supports HTTP/2 and WebSocket, which boosts efficiency and reduces latency in web communications. With its non-blocking support, developers can implement reactive and responsive applications more effectively. These updates modernize Java's web capabilities, aligning them with contemporary standards and development practices .

The introduction of sealed classes in Java 15 provides significant advancements in Java's enforcement of object-oriented programming principles like encapsulation and inheritance. Sealed classes allow developers to explicitly define which classes are permitted to extend them. This restriction enhances security and robustness by preventing unwanted extensions, thus mitigating the risks of misuse and improving maintainability. Sealed classes also promote better modeling of real-world hierarchies by explicitly expressing their constraints, aligning with the principles of encapsulation and clear structure .

The removal of the Nashorn JavaScript Engine in Java 15 affects Java's use cases by limiting its built-in support for running JavaScript, which was previously used for scripting within Java applications. This change pushes developers towards more robust solutions or integrations with external JavaScript engines or languages, facilitating a focus on core Java capabilities. Although it narrows Java’s use case in directly supporting JavaScript, it encourages better practice by using Java for its strengths in enterprise environments and leveraging API-based integrations for dynamic language support .

Lambda expressions were introduced in Java 8 to address the need for a more concise syntax and better support for functional programming paradigms. They enable the writing of inline implementation of functional interfaces, significantly reducing the boilerplate code traditionally required for anonymous classes. Subsequent versions, such as Java 11's compile-free launch and var in lambda expressions, further expanded their use case by enabling more dynamic and flexible code patterns. These changes collectively strengthened Java's capability to support functional programming approaches, empowering developers with more expressive and readable code .

Java 11 introduced two new garbage collectors: ZGC (Experimental) and Epsilon. ZGC is a low-latency garbage collector designed to perform most of its work concurrently without stopping application threads, thereby improving performance for applications requiring quick response times. Epsilon serves as a no-op collector that is useful in specific scenarios like performance testing, where garbage collection is unnecessary. Java 15 further advanced garbage collection with ZGC and Shenandoah, both of which focus on reducing pause times and improving application throughput .

Java 11 introduced several new I/O capabilities, such as writeString() and readString(), which simplify file operations by reducing boilerplate code and improving usability compared to previous versions. These methods provide a direct way to read from and write to files using strings, thus improving the efficiency and readability of code. This simplification is particularly beneficial for handling textual data and aids in reducing common errors associated with file handling .

Context-specific deserialization filters introduced in Java 17 enhance application security by providing more granular control over the deserialization process. These filters mitigate risks associated with deserialization vulnerabilities, such as arbitrary code execution, by allowing developers to define acceptable classes for deserialization dynamically based on context. This level of control significantly reduces the attack surface for deserialization-based exploits, promoting safer application practices and supporting robust security models .

Enhancements to the Stream API in Java 9 and beyond, including methods like takeWhile() and dropWhile(), allow for more efficient data processing by enabling operations that can short-circuit evaluations based on conditions. These additions empower developers to write cleaner and more declarative code. Further enhancements in Java 12, such as Collectors.teeing(), enable multiple downstream operations, which increases the functional programming capabilities by allowing the simultaneous processing of streams in multiple ways .

The removal of features like RMI Activation and the deprecation of the Security Manager in Java 17 reflect Java's evolution towards a more streamlined, efficient enterprise platform. This transition aligns Java with modern application requirements that prioritize performance and security over legacy support. By removing outdated or less-used features, Java can focus on enhancing core functionalities and supporting modern enterprise application needs, thus maintaining its relevance and efficiency in current technology landscapes .

You might also like