JAVA 8 TO 19
NOW AND THE FUTURE
Where Is Java Now?
The Timeline
Java 9
• September 2017
• Java platform module system
• Interface Private Methods
• HTTP 2 Client
• JShell – REPL Tool
• Platform and JVM Logging
• Process API Updates
• Collection API Updates
• Improvements in Stream API
• Multi-Release JAR Files
• @Deprecated Tag Changes
• Stack Walking
• Java Docs Updates
Java 10
• March 2018
• JEP 286: Local Variable Type Inference
• JEP 322: Time-Based Release Versioning
• JEP 304: Garbage-Collector Interface
• JEP 307: Parallel Full GC for G1
• JEP 316: Heap Allocation on Alternative
Memory Devices
• JEP 296: Consolidate the JDK Forest into a
Single Repository
• JEP 310: Application Class-Data Sharing
• JEP 314: Additional Unicode Language-Tag
Extensions
• JEP 319: Root Certificates
• JEP 317: Experimental Java-Based JIT
Compiler
• JEP 312: Thread-Local Handshakes
• JEP 313: Remove the Native-Header
Generation Tool
• New Added APIs and Options
• Removed APIs and Options
•Java 11
• September 2018
• HTTP Client API
• Launch Single-File Programs Without
Compilation
• String API Changes
• Collection.toArray(IntFunction)
• Files.readString() and Files.writeString()
• Optional.isEmpty()
The Timeline
Java 12
•March 19, 2019
• Collectors.teeing() in Stream API
• String API Changes
• Files.mismatch(Path, Path)
• Compact Number Formatting
• Support for Unicode 11
Java 13
•September 17, 2019
• JEP 353 – Reimplement the Legacy
Socket API
• JEP 350 – Dynamic CDS Archive
• JEP 351 – ZGC: Uncommit Unused
Memory
• FileSystems.newFileSystem() Method
• DOM and SAX Factories with
Namespace Support
•Java 14
•March 17, 2020
• JEP 368 – Text Blocks (Second
Preview)
• JEP 358 – Helpful
NullPointerExceptions
• JEP 361 – Switch Expressions
(Standard)
• JEP 345 – NUMA-Aware Memory
Allocation for G1
• JEP 349 – JFR Event Streaming
• JEP 352 – Non-Volatile Mapped Byte
Buffers
• JEP 363 – Remove the Concurrent
Mark Sweep (CMS) Garbage
Collector
• JEP 367 – Remove the Pack200 Tools
and API
The Timeline
Java 15
•September 15, 2020
•EdDSA Algorithm (JEP 339)
•Hidden Classes (JEP 371)
•Removed Nashorn JavaScript Engine (JEP 372)
•Reimplement the Legacy DatagramSocket API
(JEP 373)
•Text Blocks (JEP 378)
Java 16
•March 16, 2021
•JEP 347: Enable C++14 Language Features
•JEP 357: Migrate from Mercurial to Git
•JEP 369: Migrate to GitHub
•JEP 376: ZGC: Concurrent Thread-Stack
Processing
•JEP 380: Unix-Domain Socket Channels
•JEP 386: Alpine Linux Port
•JEP 387: Elastic Metaspace
•JEP 388: Windows/AArch64 Port
•JEP 390: Warnings for Value-Based Classes
•JEP 392: Packaging Tool
•JEP 394: Pattern Matching for instanceof
•JEP 395: Records
•JEP 396: Strongly Encapsulate JDK Internals by
Default
•Java 17
•September 14, 2021
•(JEP-306) Restore Always-Strict Floating-Point
Semantics
•(JEP-356) Enhanced Pseudo-Random Number
Generators
•(JEP-382) New macOS Rendering Pipeline
•(JEP-391) macOS/AArch64 Port
•(JEP-398) Deprecate the Applet API for Removal
•(JEP-403) Strongly Encapsulate JDK Internals
•(JEP-406) Pattern Matching for switch (Preview)
•(JEP-407) Remove RMI Activation
•(JEP-409) Sealed Classes
•(JEP-410) Remove the Experimental AOT and JIT
Compiler
•(JEP-411) Deprecate the Security Manager for
Removal
•(JEP-415) Context-Specific Deserialization Filters
The Timeline
Java 18
• 22 March 2022
• JEP-400: UTF-8 by Default
• JEP-408: Simple Web Server
• JEP-413: Code Snippets in Java API
Documentation
• JEP-416: Reimplement Core Reflection
with Method Handles
• JEP-418: Internet-Address Resolution SPI
• JEP-421: Deprecate Finalization for
Removal
Java 19
• September 2022
• JEP 405 Record Patterns (Preview)
• JEP 422 Linux/RISC-V Port
• JEP 424 Foreign Function & Memory API
(Preview)
• JEP 425 Virtual Threads (Preview)
• JEP 426 Vector API (Fourth Incubator)
• JEP 427 Pattern Matching for switch (Third
Preview)
• JEP 428 Structured Concurrency
(Incubator)
Major Ongoing Java Projects
• Project Loom
Project Loom aims to deliver a lighter version of threads, called virtual threads.
• Project Panama
Project Panama simplifies the process of connecting Java programs to non-Java components.
Aims to enable straightforward communication between Java applications and C-based libraries.
• Project Valhalla
Project Valhalla aims to improve performance as it relates to access to data items by introducing value types,
which are a new form of data type that is programmed like objects but accessed like primitives.
• Project Amber
Project Amber describes its goal as “explore and incubate smaller, productivity-oriented Java language features
that have been accepted as candidate JEPs.” Amber has been the springboard from which several of the recent
language improvements have been launched, starting with the addition of the var keyword for local variables in
Java 10.
• And many more which you can find on OpenJDK's website.
Refresher : Basics of Encapsulation
• What is it?
• Why do we need it?
• Don't want to share data with other classes or share only after certain checks
• Don't want other classes to override logic in certain methods
• How do we implement it in Java?
• Access specifiers: private, protected, public
Private Methods in Interface
• Introduced in Java 9
• No way to hide logic written in default and static methods in an
interface
• Private methods in Interface solves this problem
Local Variable Type Inference
• Introduced in Java 10
• What is the need for this feature?
Strongly Typed vs Loosely Typed Language
Strongly Typed Language Loosely Typed Language
Do have to explicitly specify types of variables and
objects.
Don’t have to explicitly specify types of variables and
objects.
Gives much more structure to a program. More flexible.
The compiler can detect most errors at compile time. Errors are detected at runtime.
Switch Statement
• The switch statement is constantly evolving.
• Here are three of the most significant recent improvements:
• arrow syntax.
• case null option.
• switch expressions.
Arrow Syntax In Switch
• JDK 14 added the ability to use the new arrow syntax (->) for
the case clauses in a switch.
• When you replace the colons with arrows, the break statements are
no longer needed.
• You cannot mix colons and arrows within the same switch.
The Case Null Clause In Switch
• JDK 17 adds the (preview) ability to include the previously
illegal case null clause in a switch.
• In general, multiple patterns can be combined into one case using
commas. You can even combine null with another pattern.
• default does not capture null.
Using Switch As An Expression
• Historically, switch has always been a statement, and statements
don’t generate a result. JDK 14 allows switch to also be
an expression, and when used in this way, switch produces a result.
Pattern Matching
• You can currently use pattern variables for instanceof and
for switch.
Pattern Variables
• Pattern variables are final local variables that are
declared and initialized at the same place.
• Also, you cannot assign another value to a pattern variable since it is
implicitly final.
• The pattern variables are those that store data from the target only if
the predicate returns true.
Guards
• A guard allows you to refine the matching condition beyond simply
matching the type. It is a test that appears after the type and &&. The
guard can be any Boolean expression.
Dominance
• The order of the case statements in a switch can be important
because if the base type appears first, it dominates anything
appearing afterward.
Advantages
• With pattern matching, the selector expression is expanded to
include any reference type.
• It makes the code easy to read and clutter-free.
Java Records
• Introduced in Java 16
• What is the need for Java Records?
Features Of Records
• Records automatically generate
• Immutable fields
• A canonical constructor
• An accessor method for each element
• The equals() method
• The hashCode() method
• The toString() method
POJO Class vs Record Class
POJO Record
It can have non-final fields Can only have private final fields for each
Not final Implicitly final
Can extend other class They can not extend any other class
They are mutable They are designed to be immutable, so no setters
Used when there is no need for restrictions.
Used when you don’t want anyone to change the
state of your object (i.e. member variables).
One use-case for Records is for example one needs to create a data object for BankAccountDetails.
The fields (accountNumber, name, etc) can only be set once and not be changed afterward.
Sealed Classes
• Introduced in Java 17
• Implementation and Extension control
• Sealed Interfaces and Classes
• Non-Sealed Interfaces and Classes
Ease of Programming Features
- Textblocks
- Ease of creating collections
- Ease of reading and writing to files
- Ease of processing text content
Click to add text
Click to add text
Conclusion
Career Pathways
- By Skill (Tools Vs Platforms)
- By Domain (Financial services, Insurance etc)
- By industry segment (Consulting, Captives, Product, Startups)
REFERENCE
StackOverflow 2022 Survey:
https://survey.stackoverflow.co/2022/#most-popular-technologies-language
ThoughtWorks Technology Radar:
https://www.thoughtworks.com/radar
CloudNative Foundation:
https://radar.cncf.io/