Hacker News new | ask | show | jobs
by brabel 767 days ago
Java 21's pattern matching (you don't need functionaljava, and shouldn't really use that unless you're really into FP) is kind of nicer than Kotlin's, because you can automatically "destruct" records in your matches.

For Java, see https://www.baeldung.com/java-lts-21-new-features

Kotlin's: https://www.baeldung.com/kotlin/when

Make up your own mind.

1 comments

> kind of nicer than Kotlin's, because you can automatically "destruct" records in your matches.

I find positional destructuring of records a bad idea.

https://news.ycombinator.com/item?id=31399737