Introduction
Java 1.1 introduced inner classes.
Java 2 introduced Swing and Collections.
Java 5 introduced Generics.
Java 8 – introduced March 2014
- Lambda expressions : A concise way to represent a method interface using an expression. Lambda expressions are useful for passing functionality as an argument to methods. Lambda Expressions, a new language feature, has been introduced in this release. They enable you to treat functionality as a method argument, or code as data. Lambda expressions let you express instances of single-method interfaces (referred to as functional interfaces) more compactly.
- Method References: Refer to methods easily. Method references provide easy-to-read lambda expressions for methods that already have a name.
- Default methods: Allow non-abstract methods to be added to interfaces. Default methods provide backward compatibility to existing codebases when new methods are added to interfaces. Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.
- Stream API: Allows functional-style operations on streams of elements. A stream represents a sequence of elements on which one or more operations can be performed.
- Annotation changes Repeating Annotations provide the ability to apply the same annotation type more than once to the same declaration or type use. Type Annotations provide the ability to apply an annotation anywhere a type is used, not just on a declaration. Used with a pluggable type system, this feature enables improved type checking of your code.
- Method parameter reflection
- Date and time API: Includes immutable, thread-safe classes such as LocalDate and ZonedDateTime to provide more accurate and flexible date-time management.
- Functional interfaces: Interfaces that contain one function inside it.
- forEach: A new method forEach() to iterate the elements. It is defined in Iterable and Stream interfaces.
- Collection API improvements: Enhanced methods for collections, such as removeIf and replaceAll.
- Concurrency API improvements: New classes for parallel processing, such as CompletableFuture.
- Optional Class: Handle null values safely.
- Static Methods: Allows adding methods with default implementations to interfaces.
VM Changes
- Modules (Jigsaw) (Java 9)
- Shenandoah (Java 12)
- Microbenchmark Suite (Java 12)
- Virtual Threads – Loom (Java 21)
- Deprecation of finalization (Java 9)
- UTF-8 by default (Java 18)
Language changes
- Try with resource
- Private method in interfaces (Java 9)
- var Keyword (Java 10)
- Switch expression (Java 14)
- Sealed classes (Java 17)
- Pattern matching instanceof (Java 16)
- Text blocks (Java 15)
- Records (Java 16)
- Records patterns (Java 19 Preview)
- String templates (Java 21 Preview)
- Unnamed patterns and variables (Java 21 Preview)
APIs
- Http Client(Java 11)
- Foreign function and memory API – Panama (Java 19)
- Structured concurrency (Java 19)
- Serialization filtering (Java 9)
- Scoped values (Java 20)
- Sequence collections(Java 21)
Future
- GraalVM
- Valhalla
- Vector API
java.lang and java.util Packages
- Parallel Array Sorting
- Standard Encoding and Decoding Base64
- Unsigned Arithmetic Support
JDBC
- The JDBC-ODBC Bridge has been removed.
- JDBC 4.2 introduces new features.
Java DB
- JDK 8 includes Java DB 10.10.
Concurrency
- Classes and interfaces have been added to the
java.util.concurrent
package. - Methods have been added to the
java.util.concurrent.ConcurrentHashMap
class to support aggregate operations based on the newly added streams facility and lambda expressions. - Classes have been added to the
java.util.concurrent.atomic
package to support scalable updatable variables. - Methods have been added to the
java.util.concurrent.ForkJoinPool
class to support a common pool. - The
java.util.concurrent.locks.StampedLock
class has been added to provide a capability-based lock with three modes for controlling read/write access.
Collections
- Classes in the new
java.util.stream
package provide a Stream API to support functional-style operations on streams of elements. The Stream API is integrated into the Collections API, which enables bulk operations on collections, such as sequential or parallel map-reduce transformations. - Performance Improvement for HashMaps with Key Collisions