Java 21 Live Code Demo - Feature - Pattern Matching for Switch

preview_player
Показать описание
JEP 441: Pattern Matching for switch

Goals
Expand the expressiveness and applicability of switch expressions and statements by allowing patterns to appear in case labels.

Allow the historical null-hostility of switch to be relaxed when desired.

Increase the safety of switch statements by requiring that pattern switch statements cover all possible input values.

Ensure that all existing switch expressions and statements continue to compile with no changes and execute with identical semantics.
Рекомендации по теме
visit shbcf.ru