To run each example use:
sh build.sh
java -cp bin <ClassName>
- 181 - Nest-Based Access Control
- 309 - Dynamic Class-File Constants
- 315 - Improve Aarch64 Intrinsics
- 318 - Epsilon: A No-Op Garbage Collector
- 320 - Remove the Java EE and CORBA Modules
- 321 - HTTP Client (Standard)
- 323 - Local-Variable Syntax for Lambda Parameters
- 324 - Key Agreement with Curve25519 and Curve448
- 327 - Unicode 10
- 328 - Flight Recorder
- 329 - ChaCha20 and Poly1305 Cryptographic Algorithms
- 330 - Launch Single-File Source-Code Programs
- 331 - Low-Overhead Heap Profiling
- 332 - Transport Layer Security (TLS) 1.3
- 333 - ZGC: A Scalable Low-Latency Garbage Collector (Experimental)
- 335 - Deprecate the Nashorn JavaScript Engine
- 336 - Deprecate the Pack200 Tools and API
- Removal of modules and deprecated API
- Removal of Java EE Modules
- JAF
- CORBA
- JTA
- JAXB
- JAX-WS
- Commons Annotation
- JavaFX
- Removal of Java EE Modules
- Scripting
- Shebang
#!/opt/jdk-11/bin/java --source 11
- var in lambda expressions
- allowing to use annotation without specifying the type:
.filter((@Nonnull var item) -> isAllowed(item))
- allowing to use annotation without specifying the type:
- API improvements
- String
lines()
: to streaming the lines from a stringstrip()
,stripLeading()
andstripTrailing()
repeat(int)
isBlank()
- Path
of(String, String...)
andof(URI)
- Files
readString(Path)
: read the entire content from a file as a String -Files.readString(Path.of("message.txt"))
writeString(Path, CharSequence, OpenOption...)
write a String to a file -Files.writeString(Path.of("message.txt"), updatedMessage)
- Null I/O
InputStream.nullInputStream()
: empty input streamOutputStream.nullOutputStream()
: output stream that discards input bytesReader.nullReader()
: empty readerWriter.nullWriter()
: writer that discards input content
- New better way to turn a collection into an array
String[] array = list.toArray(String[]::new)
Optional::isEmpty
Predicate::not
Pattern::asMatchPredicate
- String
- CDS
- The Class data sharing (CDS) feature helps reduce the startup time and memory footprint between multiple Java Virtual Machines (JVM).
- To use CDS we need permition to write to lib dir:
$JAVA_HOME/lib/server/classes.jsa
- Steps:
- First we need to generate the class list with the loaded classes:
java -XX:DumpLoadedClassList=<my-classes-list-file.lst>
- Then generate the dump using the class list:
java -XX:SharedClassListFile=<my-classes-list-file.jsa> -Xshare:dump
- To use:
java -XX:SharedArchiveFile=<my-classes-list-file.jsa>
- First we need to generate the class list with the loaded classes: