René's URL Explorer Experiment


Title: Pattern matching in switch | java.evolved

Open Graph Title: Pattern matching in switch | java.evolved

X Title: Pattern matching in switch | java.evolved

Description: Replace if-else instanceof chains with clean switch type patterns.

Open Graph Description: Replace if-else instanceof chains with clean switch type patterns.

X Description: Replace if-else instanceof chains with clean switch type patterns.

Opengraph URL: https://javaevolved.github.io/language/pattern-matching-switch.html

direct link

Domain: javaevolved.github.io


Hey, it has json ld scripts:
  {
    "@context": "https://schema.org",
    "@type": "TechArticle",
    "headline": "Pattern matching in switch",
    "description": "Replace if-else instanceof chains with clean switch type patterns.",
    "url": "https://javaevolved.github.io/pattern-matching-switch.html",
    "publisher": {
        "@type": "Organization",
        "name": "java.evolved",
        "url": "https://javaevolved.github.io"
    },
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://javaevolved.github.io/pattern-matching-switch.html"
    }
}
  
  {
    "@context": "https://schema.org",
    "@type": "BreadcrumbList",
    "itemListElement": [
        {
            "@type": "ListItem",
            "position": 1,
            "name": "Home",
            "item": "https://javaevolved.github.io/"
        },
        {
            "@type": "ListItem",
            "position": 2,
            "name": "Language",
            "item": "https://javaevolved.github.io/#language"
        },
        {
            "@type": "ListItem",
            "position": 3,
            "name": "Pattern matching in switch"
        }
    ]
}
  

theme-color#f97316
mobile-web-app-capableyes
apple-mobile-web-app-status-bar-styleblack-translucent
apple-mobile-web-app-titlejava.evolved
og:typearticle
og:site_namejava.evolved
og:localeen
og:imagehttps://javaevolved.github.io/og/language/pattern-matching-switch.png
og:image:width1200
og:image:height630
og:image:typeimage/png
twitter:cardsummary_large_image
twitter:imagehttps://javaevolved.github.io/og/language/pattern-matching-switch.png

Links:

java.evolvedhttps://javaevolved.github.io/
https://github.com/javaevolved/javaevolved.github.io
← All patternshttps://javaevolved.github.io/
https://javaevolved.github.io/language/private-interface-methods.html
https://javaevolved.github.io/language/guarded-patterns.html
Homehttps://javaevolved.github.io/
Languagehttps://javaevolved.github.io/#language
🐛 Report a code issuehttps://github.com/javaevolved/javaevolved.github.io/issues/new?template=code-issue.yml&title=%5BCode%20Issue%5D%20Pattern%20matching%20in%20switch&category=language&slug=pattern-matching-switch
🌐 Report a translation issuehttps://github.com/javaevolved/javaevolved.github.io/issues/new?template=translation-issue.yml&title=%5BTranslation%5D%20Pattern%20matching%20in%20switch%20%28English%29&locale=en&pattern=pattern-matching-switch&area=Pattern%20content
💡 Suggest a new patternhttps://github.com/javaevolved/javaevolved.github.io/issues/new?template=new-pattern.yml
𝕏https://x.com/intent/tweet?url=https%3A%2F%2Fjavaevolved.github.io%2Flanguage%2Fpattern-matching-switch.html&text=Pattern%20matching%20in%20switch%20%E2%80%93%20java.evolved
🦋https://bsky.app/intent/compose?text=Pattern%20matching%20in%20switch%20%E2%80%93%20java.evolved%20https%3A%2F%2Fjavaevolved.github.io%2Flanguage%2Fpattern-matching-switch.html
inhttps://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fjavaevolved.github.io%2Flanguage%2Fpattern-matching-switch.html
https://www.reddit.com/submit?url=https%3A%2F%2Fjavaevolved.github.io%2Flanguage%2Fpattern-matching-switch.html&title=Pattern%20matching%20in%20switch%20%E2%80%93%20java.evolved
Let us know.https://github.com/javaevolved/javaevolved.github.io/issues/new?template=code-issue.yml&title=%5BCode%20Issue%5D%20Pattern%20matching%20in%20switch&category=language&slug=pattern-matching-switch
Pattern Matching for switch (JEP 441) ↗https://openjdk.org/jeps/441
View proof source ↗https://github.com/javaevolved/javaevolved.github.io/blob/main/proof/language/PatternMatchingSwitch.java
Language Beginner Pattern matching for instanceof Java 8 if (obj instanceof String) { String s = (String) obj; int length = s.length(); // do something with 'length' } Java 16+ if (obj instanceof String s) { int length = s.length(); // do something with 'length' } Hover to see modern ➜ JDK 16+ → https://javaevolved.github.io/language/pattern-matching-instanceof.html
Language Beginner Unnamed variables with _ Java 8 try { parse(input); } catch (Exception ignored) { log("parse failed"); } map.forEach((key, value) -> { process(value); // key unused }); Java 22+ try { parse(input); } catch (Exception _) { log("parse failed"); } map.forEach((_, value) -> { process(value); }); Hover to see modern ➜ JDK 22+ → https://javaevolved.github.io/language/unnamed-variables.html
Language Beginner Records for data classes Java 8 public class Point { private final int x, y; public Point(int x, int y) { ... } public int getX() { return x; } public int getY() { return y; } // equals, hashCode, toString } Java 16+ public record Point(int x, int y) {} Hover to see modern ➜ JDK 16+ → https://javaevolved.github.io/language/records-for-data-classes.html
java.evolvedhttps://javaevolved.github.io/
Bruno Borgeshttps://github.com/brunoborges
GitHub Copilothttps://github.com/features/copilot
modern-css.comhttps://modern-css.com
View on GitHubhttps://github.com/javaevolved/javaevolved.github.io

Viewport: width=device-width, initial-scale=1.0

Robots: index, follow


URLs of crawlers that visited me.