JAVA FEATURES FROM JAVA 8 TO JAVA19

Benhlalyounes
7 min readJan 13, 2023

--

Java is a popular programming language that has undergone many changes and updates throughout its history. Since its release in 1995, the Java language has evolved to include a wide range of new features and improvements. In this article, we will take a look at some of the key features that have been introduced in each version of Java starting from Java 8.

Java 8:

  • Lambda Expressions: Java 8 introduced a new feature called lambda expressions, which allow for functional programming in Java. This feature enables developers to use anonymous functions and pass them as arguments to methods.
  • Stream API: Java 8 also introduced the Stream API, which allows developers to perform operations on collections of data in a functional style. The Stream API allows for operations such as filtering, mapping, and reducing to be performed on large datasets in a parallel and efficient manner.
  • Date and Time API: Java 8 also introduced a new Date and Time API, which provides a more robust and readable way to handle date and time operations in Java.
  • Default and static methods in interfaces: Java 8 allows interfaces to have default methods and static methods. It allows new functionality to be added to existing interfaces without breaking existing implementations.

Java 9:

  • Modular System: Java 9 introduced the Java Platform Module System (JPMS), which allowed Java developers to divide the JDK into a set of modules that can be managed separately.
  • JShell: Java 9 introduced JShell, which is an interactive command-line tool that allows developers to quickly test and run Java code snippets.
  • Improved Process API: Java 9 introduced an improved Process API, which allows developers to handle and manage operating system processes more easily.
  • Improved HTTP/2 Client: Java 9 introduced an improved HTTP/2 client, which is faster and more efficient than the previous HTTP client.

Java 10:

  • Local Variable Type Inference: Java 10 introduced local variable type inference, which allows developers to use the “var” keyword instead of specifying the type of a local variable.
  • Additional Unicode Language-Tag Extensions: Java 10 added additional Unicode language-tag extensions to the existing Locale class.
  • Garbage Collector Interface: Java 10 introduced the Garbage Collector Interface, which allows developers to create and use custom garbage collectors with the Java Virtual Machine (JVM).
  • Additional Root Certificates: Java 10 included additional root certificates to improve the security of Java-based applications.

Java 11:

  • Local-Variable Syntax for Lambda Parameters: Java 11 introduced a new syntax for lambda parameters that allows developers to use the var keyword for lambda parameters, similar to how it can be used for local variables.
  • HttpClient API: Java 11 introduced a new HttpClient API that allows developers to handle HTTP requests and responses more easily and efficiently.
  • String and Lining API improvements: Java 11 introduced several new methods in the String class, such as strip() and repeat() and in the Lining class such as lines() and isBlank().

Java 12:

  • Switch Expressions: Java 12 introduced switch expressions, which allows developers to use the switch statement as an expression, rather than just a statement.
  • Text Blocks: Java 12 introduced text blocks, which allows developers to write multi-line string literals in a more readable and convenient way.
  • Improve the performance of JVM Constants API: Java 12 improved the performance of the JVM Constants API, which allows developers to access class-file constants more efficiently.
  • Shenandoah: A Low-Pause-Time Garbage Collector: Java 12 introduced Shenandoah, a new garbage collector that promises to have much lower pause times than other existing garbage collectors.

Java 13:

  • Text Blocks (Preview Feature): Java 13 has improved the Text Blocks feature introduced in Java 12, by making it more stable and easier to use.
  • Switch Expressions (Preview Feature): Java 13 has also improved the Switch Expressions feature introduced in Java 12, by making it more expressive and powerful.
  • Reimplementation of Legacy Socket API: Java 13 has re-implemented the legacy Socket API, which provides a more modern and efficient way of working with sockets in Java.
  • New String Methods: Java 13 has added several new String methods, such as indent() and transform(), which allow developers to manipulate and format strings in a more convenient way.
  • Improved Error Handling: Java 13 has improved the way errors are handled in the JVM, by providing more detailed information about the cause of an error and making it easier to diagnose and fix issues.

As you can see, each version of Java has brought new features and improvements to the language. The addition of Lambda Expressions and Stream API in Java 8 has changed the way developers write code and perform data manipulation. The introduction of the JPMS in Java 9 and the HttpClient API in Java 11, improved the performance and security of Java-based applications. And the preview features like Switch Expressions and Text Blocks in Java 12 and 13, offer more expressive and powerful ways to write code.

Java 14:

  • Pattern Matching for instanceof: Java 14 introduced pattern matching for the instanceof operator, which allows developers to match an object against a pattern and extract its components, similar to how it can be done in functional programming languages.
  • Records: Java 14 introduced records, which allow developers to declare classes in a more concise and expressive way, similar to data classes in other languages.
  • Helpful NullPointerExceptions: Java 14 introduced a new feature that provides more information in NullPointerExceptions, making it easier to identify the cause of the exception and fix the problem.
  • Switch Expressions (Standard Feature): Java 14 has made the Switch Expressions feature introduced in Java 12 a standard feature, which means it’s now a permanent part of the Java language.
  • Text Blocks (Standard Feature): Java 14 has also made the Text Blocks feature introduced in Java 12 a standard feature, which means it’s now a permanent part of the Java language.

Java 15:

  • Sealed Classes: Java 15 introduced sealed classes, which allow developers to specify which classes can extend a particular class or implement a particular interface.
  • Hidden Classes: Java 15 introduced hidden classes, which are classes that are not part of the public API and can only be used by the classes that define them.
  • Pattern Matching for instanceof (Preview): Java 15 has improved the pattern matching for instanceof feature introduced in Java 14, by adding support for matching against multiple patterns in a single statement.
  • Foreign-Memory Access API: Java 15 introduced the Foreign-Memory Access API, which allows developers to access and manipulate memory outside of the Java heap in a safe and efficient way.

Java 16:

  • Records (Standard Feature): Java 16 has made the Records feature introduced in Java 14 a standard feature, which means it’s now a permanent part of the Java language.
  • Pattern Matching for instanceof (Standard Feature): Java 16 has made the pattern matching for instanceof feature introduced in Java 14 a standard feature, which means it’s now a permanent part of the Java language.
  • Packaging Tool: Java 16 introduced the packaging tool, which allows developers to package their Java applications as native executables for different platforms, such as Windows, Linux, and macOS.
  • Concurrent Thread-Stack Processing: Java 16 introduced a new feature that allows the JVM to process thread stacks concurrently, which improves the performance of the

Java 17:

  • Concise Method Bodies (Preview Feature): Java 17 introduced the “Concise Method Bodies” feature, which allows developers to define methods using a more concise and readable syntax.
  • Improved Deprecation Warning: Java 17 improved the deprecation warning feature, which now provides more detailed information about deprecated elements and how to replace them.
  • Hidden Classes (Standard Feature): Java 17 has made the Hidden Classes feature introduced in Java 15 a standard feature, which means it’s now a permanent part of the Java language.
  • Foreign-Memory Access API (Standard Feature): Java 17 has made the Foreign-Memory Access API feature introduced in Java 15 a standard feature, which means it’s now a permanent part of the Java language.

Java 18:

  • Records (Preview Feature): Java 18 has improved the Records feature introduced in Java 14, by adding support for more complex record types and providing more flexibility in how records can be used.
  • Concise Method Bodies (Standard Feature): Java 18 has made the Concise Method Bodies feature introduced in Java 17 a standard feature, which means it’s now a permanent part of the Java language.
  • Improved Type Inference: Java 18 has improved the type inference feature, which now allows developers to use more complex types and perform more advanced type checking.
  • Improved Security: Java 18 has improved the security of Java-based applications by introducing new features such as enhanced class-file validation and improved access control.

Java 19:

  • Records (Standard Feature): Java 19 has made the Records feature introduced in Java 14 a standard feature, which means it’s now a permanent part of the Java language.
  • Improved Garbage Collection: Java 19 has improved the garbage collection feature by introducing new algorithms and strategies that improve the performance and efficiency of the JVM.
  • Improved Error Handling: Java 19 has improved the error handling feature by providing more detailed information about errors and making it easier to diagnose and fix issues.
  • Improved Concurrency: Java 19 has improved the concurrency feature by introducing new classes and methods that make it easier for developers to write multi-threaded code.
  • Improved Security: Java 19 has improved the security of Java-based applications by introducing new features such as enhanced class-file validation and improved access control.

It’s important to note that this list is not exhaustive and there are other features and improvements that have been introduced in each version of Java. Additionally, some of the features listed here may have been in “Preview” or experimental state in certain version, but the list includes when they have made it to the standard feature. It’s also worth noting that Oracle has announced that they will release new version of Java every 6 months, so there will be more frequent updates to the language.

Conclusion:

In conclusion, Java is a powerful and versatile programming language that has undergone many changes and updates throughout its history. Each version of Java has introduced new features and improvements that have made the language more expressive, powerful, and efficient. Some of the most notable features introduced in recent versions of Java include Lambda Expressions and Stream API in Java 8, the Java Platform Module System (JPMS) in Java 9, Local Variable Type Inference in Java 10, Records in Java 14, and Concise Method Bodies in Java 18. These features have made it easier for developers to write code, perform data manipulation, improve performance, and handle errors. Additionally, Java's new release model, which is every 6 months, allows for more frequent updates to the language and quicker adoption of new features by developers.

--

--