boolean result = switch(ternaryBool) {
case TRUE -> true;
case FALSE -> false;
case FILE_NOT_FOUND -> throw new UncheckedIOException(
"This is ridiculous!",
new FileNotFoundException());
default -> throw new IllegalArgumentException("Seriously?!");
}
https://habr.com/ru/post/724186/
👉@BookJava