<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Switch on Devops Monk</title><link>https://devops-monk.com/tags/switch/</link><description>Recent content in Switch on Devops Monk</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Mon, 04 May 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://devops-monk.com/tags/switch/index.xml" rel="self" type="application/rss+xml"/><item><title>Pattern Matching for switch (JEP 406): Type Dispatch in switch (Preview)</title><link>https://devops-monk.com/tutorials/java17/pattern-matching-switch-preview/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java17/pattern-matching-switch-preview/</guid><description>Preview Feature in Java 17 (JEP 406 — First Preview). Requires --enable-preview. This feature evolved through Java 18 (JEP 420), Java 19 (JEP 427), Java 20 (JEP 433), and was finalized in Java 21 (JEP 441). The Java 21 final version has minor syntax differences from this Java 17 preview — documented below.
Enabling Preview Features Pattern matching for switch requires --enable-preview in Java 17. Add to your build tool:</description></item><item><title>Pattern Matching for switch (JEP 441): Type Dispatch Without the Boilerplate</title><link>https://devops-monk.com/tutorials/java21/pattern-matching-switch/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java21/pattern-matching-switch/</guid><description>The Problem: Cascading instanceof Chains Any Java codebase handling multiple subtypes has code like this:
// Java 16 and earlier — the bad old way static double calculateArea(Shape shape) { if (shape instanceof Circle) { Circle c = (Circle) shape; return Math.PI * c.radius() * c.radius(); } else if (shape instanceof Rectangle) { Rectangle r = (Rectangle) shape; return r.width() * r.height(); } else if (shape instanceof Triangle) { Triangle t = (Triangle) shape; return 0.</description></item></channel></rss>