Re:Switching from C++ to Rust
by dcow on Tuesday March 14, 2023 @01:33AM
(#35147773)
It's not exactly Java, but:
[ Parent
| on HN ]
Actually, Java does have sum types nowadays, and you can write a recursive list implementation like “new Cons(2, new Cons(3, Nil.nil()))”.
Here is a definition for a Maybe type, converting it to a List is left as an exercise to the reader :) : https://news.ycombinator.com/item?id=35133670