News for hackers. Stuff that matters.
Re:What's new in Java 12, 13 and 14 by sleavey on Tuesday December 17, 2019 @06:00AM (#21812448)
Oooh that's a good idea. Does that already exist in other languages? I've not seen it before.
Re:What's new in Java 12, 13 and 14 by nestorD on Tuesday December 17, 2019 @06:06AM (#21812471)
Ocaml, F#, Rust, Kotlin (I believe), Haskell, etc

It is a common feature in languages derives from the ML family[0].

[0]: https://en.wikipedia.org/wiki/ML_(programming_language)

Re:What's new in Java 12, 13 and 14 by kod on Tuesday December 17, 2019 @08:57AM (#21813431)
Kotlin doesn't have real pattern matching.
Re:What's new in Java 12, 13 and 14 by lllr_finger on Tuesday December 17, 2019 @09:02AM (#21813477)
It doesn't, but at least 'when' statements will be exhaustive when working with sealed classes - which is a breath of fresh air if you enjoy working with sum types and pattern matching.
Re:What's new in Java 12, 13 and 14 by kod on Tuesday December 17, 2019 @05:52PM (#21819842)
when expressions will be exhaustive, when statements will not.

Needless distinctions like that make the fresh air a little less fresh...

Re:What's new in Java 12, 13 and 14 by walkingolof on Tuesday December 17, 2019 @08:07AM (#21813073)
Scala has had this for a long long time: https://docs.scala-lang.org/tour/pattern-matching.html
Re:What's new in Java 12, 13 and 14 by johnlinvc on Tuesday December 17, 2019 @10:22PM (#21821465)
Swift also have them.