/scoped-values

Demo code showing how to use Java's scoped values

Primary LanguageJava

Scoped Values Examples

This repository contains several examples for "Scoped Values", a feature described in JEP 446 and available in Java 21 as a preview feature.

I use these examples in my presentations on structured concurrency.

Java 21 IDE Support

IntelliJ IDEA supports Java 21 as of version 2023.2.2. As long as this version is not yet released, you can install the release candidate via the JetBrains Toolbox App by going into the IntelliJ IDEA settings and activating the "Early Access Program".

Java Downloads

You can download Java 21 from here: https://jdk.java.net/21/

To install multiple Java versions on Linux or macOS, I recommend using SDKMAN!

To install multiple Java versions on Windows, have a look at this tutorial: How to Change Java Versions in Windows

Other Java 21 Examples

You might also find these GitHub repositories interesting:

Virtual Threads:

Structured Concurrency:

Pattern Matching for Switch: