[{"data":1,"prerenderedAt":919},["ShallowReactive",2],{"tag-java21":3},[4],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":8,"title":9,"description":10,"date":11,"layout":12,"subtitle":13,"image":14,"optimized_image":14,"category":15,"tags":16,"author":21,"paginate":7,"body":22,"_type":913,"_id":914,"_source":915,"_file":916,"_stem":917,"_extension":918},"/posts/pattern-matching-sealed-classes-java21","posts",false,"","A Guide to Pattern Matching and Sealed Classes in Java 21","A comprehensive introduction to pattern matching and sealed classes in Java 21, including practical examples and best practices.","2024-05-15T11:00:00.000Z","post","Writing Safer and More Expressive Java Code","/assets/img/uploads/java-pattern.matching.png","code",[15,17,18,19,20],"java","pattern-matching","sealed-classes","java21","jaimedearcos",{"type":23,"children":24,"toc":899},"root",[25,52,59,72,79,208,214,386,392,412,417,422,428,614,620,803,808,826,832,850,856,861,868,893],{"type":26,"tag":27,"props":28,"children":29},"element","blockquote",{},[30],{"type":26,"tag":31,"props":32,"children":33},"p",{},[34,37,43,45,50],{"type":35,"value":36},"text","Java 21 introduces powerful enhancements that improve readability, safety, and expressiveness in your code. Among these, ",{"type":26,"tag":38,"props":39,"children":40},"strong",{},[41],{"type":35,"value":42},"pattern matching",{"type":35,"value":44}," and ",{"type":26,"tag":38,"props":46,"children":47},{},[48],{"type":35,"value":49},"sealed classes",{"type":35,"value":51}," stand out, allowing developers to write concise, readable, and safe code. Let's explore both concepts with practical examples.",{"type":26,"tag":53,"props":54,"children":56},"h2",{"id":55},"pattern-matching-for-switch",[57],{"type":35,"value":58},"Pattern Matching for Switch",{"type":26,"tag":31,"props":60,"children":61},{},[62,64,70],{"type":35,"value":63},"Pattern matching extends the classic ",{"type":26,"tag":15,"props":65,"children":67},{"className":66},[],[68],{"type":35,"value":69},"switch",{"type":35,"value":71}," statement, making code simpler and clearer by reducing the need for explicit casting and type checking.",{"type":26,"tag":73,"props":74,"children":76},"h3",{"id":75},"traditional-switch",[77],{"type":35,"value":78},"Traditional Switch",{"type":26,"tag":80,"props":81,"children":84},"pre",{"className":82,"code":83,"language":17,"meta":8,"style":8},"language-java shiki shiki-themes github-dark github-light","Object obj = \"Hello\";\n\nif (obj instanceof String) {\n    String s = (String) obj;\n    System.out.println(s.toLowerCase());\n}\n",[85],{"type":26,"tag":15,"props":86,"children":87},{"__ignoreMap":8},[88,117,127,151,169,199],{"type":26,"tag":89,"props":90,"children":93},"span",{"class":91,"line":92},"line",1,[94,100,106,112],{"type":26,"tag":89,"props":95,"children":97},{"style":96},"--shiki-default:#E1E4E8;--shiki-light:#24292E",[98],{"type":35,"value":99},"Object obj ",{"type":26,"tag":89,"props":101,"children":103},{"style":102},"--shiki-default:#F97583;--shiki-light:#D73A49",[104],{"type":35,"value":105},"=",{"type":26,"tag":89,"props":107,"children":109},{"style":108},"--shiki-default:#9ECBFF;--shiki-light:#032F62",[110],{"type":35,"value":111}," \"Hello\"",{"type":26,"tag":89,"props":113,"children":114},{"style":96},[115],{"type":35,"value":116},";\n",{"type":26,"tag":89,"props":118,"children":120},{"class":91,"line":119},2,[121],{"type":26,"tag":89,"props":122,"children":124},{"emptyLinePlaceholder":123},true,[125],{"type":35,"value":126},"\n",{"type":26,"tag":89,"props":128,"children":130},{"class":91,"line":129},3,[131,136,141,146],{"type":26,"tag":89,"props":132,"children":133},{"style":102},[134],{"type":35,"value":135},"if",{"type":26,"tag":89,"props":137,"children":138},{"style":96},[139],{"type":35,"value":140}," (obj ",{"type":26,"tag":89,"props":142,"children":143},{"style":102},[144],{"type":35,"value":145},"instanceof",{"type":26,"tag":89,"props":147,"children":148},{"style":96},[149],{"type":35,"value":150}," String) {\n",{"type":26,"tag":89,"props":152,"children":154},{"class":91,"line":153},4,[155,160,164],{"type":26,"tag":89,"props":156,"children":157},{"style":96},[158],{"type":35,"value":159},"    String s ",{"type":26,"tag":89,"props":161,"children":162},{"style":102},[163],{"type":35,"value":105},{"type":26,"tag":89,"props":165,"children":166},{"style":96},[167],{"type":35,"value":168}," (String) obj;\n",{"type":26,"tag":89,"props":170,"children":172},{"class":91,"line":171},5,[173,178,184,189,194],{"type":26,"tag":89,"props":174,"children":175},{"style":96},[176],{"type":35,"value":177},"    System.out.",{"type":26,"tag":89,"props":179,"children":181},{"style":180},"--shiki-default:#B392F0;--shiki-light:#6F42C1",[182],{"type":35,"value":183},"println",{"type":26,"tag":89,"props":185,"children":186},{"style":96},[187],{"type":35,"value":188},"(s.",{"type":26,"tag":89,"props":190,"children":191},{"style":180},[192],{"type":35,"value":193},"toLowerCase",{"type":26,"tag":89,"props":195,"children":196},{"style":96},[197],{"type":35,"value":198},"());\n",{"type":26,"tag":89,"props":200,"children":202},{"class":91,"line":201},6,[203],{"type":26,"tag":89,"props":204,"children":205},{"style":96},[206],{"type":35,"value":207},"}\n",{"type":26,"tag":73,"props":209,"children":211},{"id":210},"pattern-matching-switch",[212],{"type":35,"value":213},"Pattern Matching Switch",{"type":26,"tag":80,"props":215,"children":217},{"className":82,"code":216,"language":17,"meta":8,"style":8},"Object obj = \"Hello\";\n\nswitch (obj) {\n    case String s -> System.out.println(s.toLowerCase());\n    case Integer i -> System.out.println(i + 1);\n    default -> System.out.println(\"Unknown type\");\n}\n",[218],{"type":26,"tag":15,"props":219,"children":220},{"__ignoreMap":8},[221,240,247,259,298,343,378],{"type":26,"tag":89,"props":222,"children":223},{"class":91,"line":92},[224,228,232,236],{"type":26,"tag":89,"props":225,"children":226},{"style":96},[227],{"type":35,"value":99},{"type":26,"tag":89,"props":229,"children":230},{"style":102},[231],{"type":35,"value":105},{"type":26,"tag":89,"props":233,"children":234},{"style":108},[235],{"type":35,"value":111},{"type":26,"tag":89,"props":237,"children":238},{"style":96},[239],{"type":35,"value":116},{"type":26,"tag":89,"props":241,"children":242},{"class":91,"line":119},[243],{"type":26,"tag":89,"props":244,"children":245},{"emptyLinePlaceholder":123},[246],{"type":35,"value":126},{"type":26,"tag":89,"props":248,"children":249},{"class":91,"line":129},[250,254],{"type":26,"tag":89,"props":251,"children":252},{"style":102},[253],{"type":35,"value":69},{"type":26,"tag":89,"props":255,"children":256},{"style":96},[257],{"type":35,"value":258}," (obj) {\n",{"type":26,"tag":89,"props":260,"children":261},{"class":91,"line":153},[262,267,272,277,282,286,290,294],{"type":26,"tag":89,"props":263,"children":264},{"style":102},[265],{"type":35,"value":266},"    case",{"type":26,"tag":89,"props":268,"children":269},{"style":96},[270],{"type":35,"value":271}," String s ",{"type":26,"tag":89,"props":273,"children":274},{"style":102},[275],{"type":35,"value":276},"->",{"type":26,"tag":89,"props":278,"children":279},{"style":96},[280],{"type":35,"value":281}," System.out.",{"type":26,"tag":89,"props":283,"children":284},{"style":180},[285],{"type":35,"value":183},{"type":26,"tag":89,"props":287,"children":288},{"style":96},[289],{"type":35,"value":188},{"type":26,"tag":89,"props":291,"children":292},{"style":180},[293],{"type":35,"value":193},{"type":26,"tag":89,"props":295,"children":296},{"style":96},[297],{"type":35,"value":198},{"type":26,"tag":89,"props":299,"children":300},{"class":91,"line":171},[301,305,310,314,318,322,327,332,338],{"type":26,"tag":89,"props":302,"children":303},{"style":102},[304],{"type":35,"value":266},{"type":26,"tag":89,"props":306,"children":307},{"style":96},[308],{"type":35,"value":309}," Integer i ",{"type":26,"tag":89,"props":311,"children":312},{"style":102},[313],{"type":35,"value":276},{"type":26,"tag":89,"props":315,"children":316},{"style":96},[317],{"type":35,"value":281},{"type":26,"tag":89,"props":319,"children":320},{"style":180},[321],{"type":35,"value":183},{"type":26,"tag":89,"props":323,"children":324},{"style":96},[325],{"type":35,"value":326},"(i ",{"type":26,"tag":89,"props":328,"children":329},{"style":102},[330],{"type":35,"value":331},"+",{"type":26,"tag":89,"props":333,"children":335},{"style":334},"--shiki-default:#79B8FF;--shiki-light:#005CC5",[336],{"type":35,"value":337}," 1",{"type":26,"tag":89,"props":339,"children":340},{"style":96},[341],{"type":35,"value":342},");\n",{"type":26,"tag":89,"props":344,"children":345},{"class":91,"line":201},[346,351,356,360,364,369,374],{"type":26,"tag":89,"props":347,"children":348},{"style":102},[349],{"type":35,"value":350},"    default",{"type":26,"tag":89,"props":352,"children":353},{"style":102},[354],{"type":35,"value":355}," ->",{"type":26,"tag":89,"props":357,"children":358},{"style":96},[359],{"type":35,"value":281},{"type":26,"tag":89,"props":361,"children":362},{"style":180},[363],{"type":35,"value":183},{"type":26,"tag":89,"props":365,"children":366},{"style":96},[367],{"type":35,"value":368},"(",{"type":26,"tag":89,"props":370,"children":371},{"style":108},[372],{"type":35,"value":373},"\"Unknown type\"",{"type":26,"tag":89,"props":375,"children":376},{"style":96},[377],{"type":35,"value":342},{"type":26,"tag":89,"props":379,"children":381},{"class":91,"line":380},7,[382],{"type":26,"tag":89,"props":383,"children":384},{"style":96},[385],{"type":35,"value":207},{"type":26,"tag":73,"props":387,"children":389},{"id":388},"benefits",[390],{"type":35,"value":391},"Benefits:",{"type":26,"tag":393,"props":394,"children":395},"ul",{},[396,402,407],{"type":26,"tag":397,"props":398,"children":399},"li",{},[400],{"type":35,"value":401},"Reduced boilerplate code",{"type":26,"tag":397,"props":403,"children":404},{},[405],{"type":35,"value":406},"Enhanced readability",{"type":26,"tag":397,"props":408,"children":409},{},[410],{"type":35,"value":411},"Improved type safety",{"type":26,"tag":53,"props":413,"children":414},{"id":19},[415],{"type":35,"value":416},"Sealed Classes",{"type":26,"tag":31,"props":418,"children":419},{},[420],{"type":35,"value":421},"Sealed classes allow you to define which subclasses or implementations are permitted. This helps in modeling clear and controlled domain hierarchies.",{"type":26,"tag":73,"props":423,"children":425},{"id":424},"declaring-a-sealed-class",[426],{"type":35,"value":427},"Declaring a Sealed Class",{"type":26,"tag":80,"props":429,"children":431},{"className":82,"code":430,"language":17,"meta":8,"style":8},"public sealed abstract class Shape\n    permits Circle, Rectangle {}\n\npublic final class Circle extends Shape {\n    double radius;\n}\n\npublic final class Rectangle extends Shape {\n    double length, width;\n}\n",[432],{"type":26,"tag":15,"props":433,"children":434},{"__ignoreMap":8},[435,463,491,498,533,546,553,560,593,606],{"type":26,"tag":89,"props":436,"children":437},{"class":91,"line":92},[438,443,448,453,458],{"type":26,"tag":89,"props":439,"children":440},{"style":102},[441],{"type":35,"value":442},"public",{"type":26,"tag":89,"props":444,"children":445},{"style":102},[446],{"type":35,"value":447}," sealed",{"type":26,"tag":89,"props":449,"children":450},{"style":102},[451],{"type":35,"value":452}," abstract",{"type":26,"tag":89,"props":454,"children":455},{"style":102},[456],{"type":35,"value":457}," class",{"type":26,"tag":89,"props":459,"children":460},{"style":180},[461],{"type":35,"value":462}," Shape\n",{"type":26,"tag":89,"props":464,"children":465},{"class":91,"line":119},[466,471,476,481,486],{"type":26,"tag":89,"props":467,"children":468},{"style":102},[469],{"type":35,"value":470},"    permits",{"type":26,"tag":89,"props":472,"children":473},{"style":180},[474],{"type":35,"value":475}," Circle",{"type":26,"tag":89,"props":477,"children":478},{"style":96},[479],{"type":35,"value":480},", ",{"type":26,"tag":89,"props":482,"children":483},{"style":180},[484],{"type":35,"value":485},"Rectangle",{"type":26,"tag":89,"props":487,"children":488},{"style":96},[489],{"type":35,"value":490}," {}\n",{"type":26,"tag":89,"props":492,"children":493},{"class":91,"line":129},[494],{"type":26,"tag":89,"props":495,"children":496},{"emptyLinePlaceholder":123},[497],{"type":35,"value":126},{"type":26,"tag":89,"props":499,"children":500},{"class":91,"line":153},[501,505,510,514,518,523,528],{"type":26,"tag":89,"props":502,"children":503},{"style":102},[504],{"type":35,"value":442},{"type":26,"tag":89,"props":506,"children":507},{"style":102},[508],{"type":35,"value":509}," final",{"type":26,"tag":89,"props":511,"children":512},{"style":102},[513],{"type":35,"value":457},{"type":26,"tag":89,"props":515,"children":516},{"style":180},[517],{"type":35,"value":475},{"type":26,"tag":89,"props":519,"children":520},{"style":102},[521],{"type":35,"value":522}," extends",{"type":26,"tag":89,"props":524,"children":525},{"style":180},[526],{"type":35,"value":527}," Shape",{"type":26,"tag":89,"props":529,"children":530},{"style":96},[531],{"type":35,"value":532}," {\n",{"type":26,"tag":89,"props":534,"children":535},{"class":91,"line":171},[536,541],{"type":26,"tag":89,"props":537,"children":538},{"style":102},[539],{"type":35,"value":540},"    double",{"type":26,"tag":89,"props":542,"children":543},{"style":96},[544],{"type":35,"value":545}," radius;\n",{"type":26,"tag":89,"props":547,"children":548},{"class":91,"line":201},[549],{"type":26,"tag":89,"props":550,"children":551},{"style":96},[552],{"type":35,"value":207},{"type":26,"tag":89,"props":554,"children":555},{"class":91,"line":380},[556],{"type":26,"tag":89,"props":557,"children":558},{"emptyLinePlaceholder":123},[559],{"type":35,"value":126},{"type":26,"tag":89,"props":561,"children":563},{"class":91,"line":562},8,[564,568,572,576,581,585,589],{"type":26,"tag":89,"props":565,"children":566},{"style":102},[567],{"type":35,"value":442},{"type":26,"tag":89,"props":569,"children":570},{"style":102},[571],{"type":35,"value":509},{"type":26,"tag":89,"props":573,"children":574},{"style":102},[575],{"type":35,"value":457},{"type":26,"tag":89,"props":577,"children":578},{"style":180},[579],{"type":35,"value":580}," Rectangle",{"type":26,"tag":89,"props":582,"children":583},{"style":102},[584],{"type":35,"value":522},{"type":26,"tag":89,"props":586,"children":587},{"style":180},[588],{"type":35,"value":527},{"type":26,"tag":89,"props":590,"children":591},{"style":96},[592],{"type":35,"value":532},{"type":26,"tag":89,"props":594,"children":596},{"class":91,"line":595},9,[597,601],{"type":26,"tag":89,"props":598,"children":599},{"style":102},[600],{"type":35,"value":540},{"type":26,"tag":89,"props":602,"children":603},{"style":96},[604],{"type":35,"value":605}," length, width;\n",{"type":26,"tag":89,"props":607,"children":609},{"class":91,"line":608},10,[610],{"type":26,"tag":89,"props":611,"children":612},{"style":96},[613],{"type":35,"value":207},{"type":26,"tag":73,"props":615,"children":617},{"id":616},"using-pattern-matching-with-sealed-classes",[618],{"type":35,"value":619},"Using Pattern Matching with Sealed Classes",{"type":26,"tag":80,"props":621,"children":623},{"className":82,"code":622,"language":17,"meta":8,"style":8},"Shape shape = new Circle();\n\ndouble area = switch (shape) {\n    case Circle c -> Math.PI * c.radius * c.radius;\n    case Rectangle r -> r.length * r.width;\n};\n\nSystem.out.println(\"Area: \" + area);\n",[624],{"type":26,"tag":15,"props":625,"children":626},{"__ignoreMap":8},[627,653,660,687,727,757,765,772],{"type":26,"tag":89,"props":628,"children":629},{"class":91,"line":92},[630,635,639,644,648],{"type":26,"tag":89,"props":631,"children":632},{"style":96},[633],{"type":35,"value":634},"Shape shape ",{"type":26,"tag":89,"props":636,"children":637},{"style":102},[638],{"type":35,"value":105},{"type":26,"tag":89,"props":640,"children":641},{"style":102},[642],{"type":35,"value":643}," new",{"type":26,"tag":89,"props":645,"children":646},{"style":180},[647],{"type":35,"value":475},{"type":26,"tag":89,"props":649,"children":650},{"style":96},[651],{"type":35,"value":652},"();\n",{"type":26,"tag":89,"props":654,"children":655},{"class":91,"line":119},[656],{"type":26,"tag":89,"props":657,"children":658},{"emptyLinePlaceholder":123},[659],{"type":35,"value":126},{"type":26,"tag":89,"props":661,"children":662},{"class":91,"line":129},[663,668,673,677,682],{"type":26,"tag":89,"props":664,"children":665},{"style":102},[666],{"type":35,"value":667},"double",{"type":26,"tag":89,"props":669,"children":670},{"style":96},[671],{"type":35,"value":672}," area ",{"type":26,"tag":89,"props":674,"children":675},{"style":102},[676],{"type":35,"value":105},{"type":26,"tag":89,"props":678,"children":679},{"style":102},[680],{"type":35,"value":681}," switch",{"type":26,"tag":89,"props":683,"children":684},{"style":96},[685],{"type":35,"value":686}," (shape) {\n",{"type":26,"tag":89,"props":688,"children":689},{"class":91,"line":153},[690,694,699,703,708,713,718,722],{"type":26,"tag":89,"props":691,"children":692},{"style":102},[693],{"type":35,"value":266},{"type":26,"tag":89,"props":695,"children":696},{"style":96},[697],{"type":35,"value":698}," Circle c ",{"type":26,"tag":89,"props":700,"children":701},{"style":102},[702],{"type":35,"value":276},{"type":26,"tag":89,"props":704,"children":705},{"style":96},[706],{"type":35,"value":707}," Math.PI ",{"type":26,"tag":89,"props":709,"children":710},{"style":102},[711],{"type":35,"value":712},"*",{"type":26,"tag":89,"props":714,"children":715},{"style":96},[716],{"type":35,"value":717}," c.radius ",{"type":26,"tag":89,"props":719,"children":720},{"style":102},[721],{"type":35,"value":712},{"type":26,"tag":89,"props":723,"children":724},{"style":96},[725],{"type":35,"value":726}," c.radius;\n",{"type":26,"tag":89,"props":728,"children":729},{"class":91,"line":171},[730,734,739,743,748,752],{"type":26,"tag":89,"props":731,"children":732},{"style":102},[733],{"type":35,"value":266},{"type":26,"tag":89,"props":735,"children":736},{"style":96},[737],{"type":35,"value":738}," Rectangle r ",{"type":26,"tag":89,"props":740,"children":741},{"style":102},[742],{"type":35,"value":276},{"type":26,"tag":89,"props":744,"children":745},{"style":96},[746],{"type":35,"value":747}," r.length ",{"type":26,"tag":89,"props":749,"children":750},{"style":102},[751],{"type":35,"value":712},{"type":26,"tag":89,"props":753,"children":754},{"style":96},[755],{"type":35,"value":756}," r.width;\n",{"type":26,"tag":89,"props":758,"children":759},{"class":91,"line":201},[760],{"type":26,"tag":89,"props":761,"children":762},{"style":96},[763],{"type":35,"value":764},"};\n",{"type":26,"tag":89,"props":766,"children":767},{"class":91,"line":380},[768],{"type":26,"tag":89,"props":769,"children":770},{"emptyLinePlaceholder":123},[771],{"type":35,"value":126},{"type":26,"tag":89,"props":773,"children":774},{"class":91,"line":562},[775,780,784,788,793,798],{"type":26,"tag":89,"props":776,"children":777},{"style":96},[778],{"type":35,"value":779},"System.out.",{"type":26,"tag":89,"props":781,"children":782},{"style":180},[783],{"type":35,"value":183},{"type":26,"tag":89,"props":785,"children":786},{"style":96},[787],{"type":35,"value":368},{"type":26,"tag":89,"props":789,"children":790},{"style":108},[791],{"type":35,"value":792},"\"Area: \"",{"type":26,"tag":89,"props":794,"children":795},{"style":102},[796],{"type":35,"value":797}," +",{"type":26,"tag":89,"props":799,"children":800},{"style":96},[801],{"type":35,"value":802}," area);\n",{"type":26,"tag":73,"props":804,"children":806},{"id":805},"benefits-1",[807],{"type":35,"value":391},{"type":26,"tag":393,"props":809,"children":810},{},[811,816,821],{"type":26,"tag":397,"props":812,"children":813},{},[814],{"type":35,"value":815},"Enhanced clarity of inheritance hierarchies",{"type":26,"tag":397,"props":817,"children":818},{},[819],{"type":35,"value":820},"Compile-time enforcement of permitted subclasses",{"type":26,"tag":397,"props":822,"children":823},{},[824],{"type":35,"value":825},"Simplified, safer code when used with pattern matching",{"type":26,"tag":53,"props":827,"children":829},{"id":828},"practical-applications",[830],{"type":35,"value":831},"Practical Applications",{"type":26,"tag":393,"props":833,"children":834},{},[835,840,845],{"type":26,"tag":397,"props":836,"children":837},{},[838],{"type":35,"value":839},"Domain modeling with restricted class hierarchies",{"type":26,"tag":397,"props":841,"children":842},{},[843],{"type":35,"value":844},"Type-safe parsing and processing of structured data",{"type":26,"tag":397,"props":846,"children":847},{},[848],{"type":35,"value":849},"Cleaner implementations of polymorphic behavior",{"type":26,"tag":53,"props":851,"children":853},{"id":852},"conclusion",[854],{"type":35,"value":855},"Conclusion",{"type":26,"tag":31,"props":857,"children":858},{},[859],{"type":35,"value":860},"Pattern matching and sealed classes provide significant improvements in Java 21, helping you write cleaner, safer, and more maintainable code. Mastering these tools allows developers to leverage the full expressive power of modern Java.",{"type":26,"tag":862,"props":863,"children":865},"h1",{"id":864},"further-reading",[866],{"type":35,"value":867},"Further Reading",{"type":26,"tag":393,"props":869,"children":870},{},[871,883],{"type":26,"tag":397,"props":872,"children":873},{},[874],{"type":26,"tag":875,"props":876,"children":880},"a",{"href":877,"rel":878},"https://openjdk.org/jeps/441",[879],"nofollow",[881],{"type":35,"value":882},"Java 21 Pattern Matching JEP",{"type":26,"tag":397,"props":884,"children":885},{},[886],{"type":26,"tag":875,"props":887,"children":890},{"href":888,"rel":889},"https://openjdk.org/jeps/409",[879],[891],{"type":35,"value":892},"Java 21 Sealed Classes JEP",{"type":26,"tag":894,"props":895,"children":896},"style",{},[897],{"type":35,"value":898},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}",{"title":8,"searchDepth":119,"depth":119,"links":900},[901,906,911,912],{"id":55,"depth":119,"text":58,"children":902},[903,904,905],{"id":75,"depth":129,"text":78},{"id":210,"depth":129,"text":213},{"id":388,"depth":129,"text":391},{"id":19,"depth":119,"text":416,"children":907},[908,909,910],{"id":424,"depth":129,"text":427},{"id":616,"depth":129,"text":619},{"id":805,"depth":129,"text":391},{"id":828,"depth":119,"text":831},{"id":852,"depth":119,"text":855},"markdown","content:posts:pattern-matching-sealed-classes-java21.md","content","posts/pattern-matching-sealed-classes-java21.md","posts/pattern-matching-sealed-classes-java21","md",1790510065072]