Re:Java record pattern matching in JDK 19
by Smaug123 on Saturday May 14, 2022 @01:00PM
(#31379919)
F# also has:
(You're allowed to just use the identifier `foo` in the match arm.)
[ Parent
| on HN ]
Re:Java record pattern matching in JDK 19
by halfmatthalfcat on Saturday May 14, 2022 @02:11PM
(#31380689)
As does Scala:
match thing {
case a: String =>
// use a as string
case a @ MyCaseClass(b: String, c, d) =>
// use a as the instance of MyCaseClass or use b as a string
}