New Features that came with Java 21
Sources: https://www.baeldung.com/java-lts-21-new-features
1.) Record Patterns
Record Patterns are like simplified CLasses. Predefined methods; itsselt and its variables are immutable (final);
2.) Pattern Matching
Swith-cases without the use of "instanceof"
3.) String literal
You can define and let variables replace in Strings. It will be used in Java 22 Templates Preview even further.
4.) Virtual Threads
Threads that are completely managed by the Java VM and not by the OS. It is way more flexible for the java programm than letting the OS manage the threads.
5.) Sequenced Collections
Lists with exact order and methods, that you can use to get for example the last and first one.
6.) Key Encapsulation Mechanism Api
It can be used to send a public key for example.