Java 12
JEP 325: Switch Expressions (Preview) (opens in a new tab)
Java 13
JEP 354: Switch Expressions (Second Preview) (opens in a new tab)
Java 14
JEP 305: Pattern Matching for instanceof (Preview) (opens in a new tab)
JEP 361: Switch Expressions (opens in a new tab)
- Arrow labels
Switchexpressions- The cases of a
switchexpression must be exhaustive; for all possible values there must be a matchingswitchlabel.
- The cases of a
- Yielding a value
Collection Factories
Stream API
-
takeWhile()anddropWhile()filter()operation looks through the entire collection and gathers all elements that match the predicate, whereastakeWhile()short-circuits this process by stopping the operation once it encounters an element that does not match the predicate, which makestakeWhile()faster.- Performance suffers if takeWhile() or dropWhile() are used on parallel streams, even when the streams are ordered.
- Resources
Java 15
JEP 360: Sealed Classes (Preview) (opens in a new tab)
JEP 371: Hidden Classes (opens in a new tab)
JEP 375: Pattern Matching for instanceof (Second Preview) (opens in a new tab)
JEP 378: Text Blocks (opens in a new tab)
Java 16
JEP 380: Unix-Domain Socket Channels (opens in a new tab)
JEP 394: Pattern Matching for instanceof (opens in a new tab)
JEP 395: Records (opens in a new tab)
-
Oracle - Java SE - 17 - Java Language Updates - 5 Record Classes (opens in a new tab)
-
Java Magazine - Bruce Eckel on Java records (opens in a new tab)
-
Resolve the issue
Recordsdo not conform to theJavaBeansspecification.Use
Lombok@Setterand@Getterannotations on fields.record Order(@Getter Integer id, @Getter String customerName) {}