<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Switch-Expressions on Devops Monk</title><link>https://devops-monk.com/tags/switch-expressions/</link><description>Recent content in Switch-Expressions 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-expressions/index.xml" rel="self" type="application/rss+xml"/><item><title>Switch Expressions (JEP 361): Switch as an Expression, Not Just a Statement</title><link>https://devops-monk.com/tutorials/java17/switch-expressions/</link><pubDate>Mon, 04 May 2026 00:00:00 +0000</pubDate><guid>https://devops-monk.com/tutorials/java17/switch-expressions/</guid><description>Finalized in Java 14 (JEP 361). Available in all Java 14+ releases, including Java 17. Previous previews: Java 12 (JEP 325) and Java 13 (JEP 354).
The Problem with Switch Statements Java&amp;rsquo;s traditional switch statement has two well-known pain points:
Pain 1: Fall-Through // Java 11 — easy to introduce fall-through bugs switch (day) { case MONDAY: result = &amp;#34;Start of work week&amp;#34;; break; // easy to forget this case TUESDAY: result = &amp;#34;Weekday&amp;#34;; // no break — falls through to WEDNESDAY case case WEDNESDAY: result = &amp;#34;Hump day&amp;#34;; break; default: result = &amp;#34;Other&amp;#34;; } A missing break causes the next case to execute unexpectedly.</description></item></channel></rss>