Call me a bloody #Java nerd, but I simply love Map#computeIfAbsent(key, func). So much ugly code eliminated!
1
1
Replying to @h_schreiber
Special purpose, mutating – ugly as hell. You’re a bloody Java nerd :)

Jan 17, 2017 · 2:16 PM UTC

1
1
Replying to @stilkov
Compared to what you have to write in plain Java to achieve the same, it’s simply beautiful, esp. for simple caches.
1
Sure, it’s just that it would be so much nicer in a decent functional language, preferably one with lots of parentheses :)
1