Deployment engineering
Finite dispatch registry
Explicit runtime choice among known alternatives. Executed Java 21 functional example; native behavior not established.
Formal Syntax & Structure
java syntaxjava
switch (tier)Working Example
Example Snippetjava
public class Main { interface Price { int cents(int quantity); } static Price select(String tier) { return switch (tier) { case "standard" -> n -> Math.multiplyExact(n, 120); case "member" -> n -> Math.multiplyExact(n, 100); default -> throw new IllegalArgumentException("unknown tier"); }; } public static void main(String[] args) { System.out.println(select("member").cents(3)); System.out.println(select("standard").cents(3)); }}