Join Slack
Powered by
What would be the best way to increment a `Map<...
# announcements
m
Marcin Wisniowski
09/25/2018, 7:20 PM
What would be the best way to increment a
Map<String, Int>
value or set it to 1 if absent? I've come up with
map.merge(key, 1) { count, _ -> count + 1}
, but I feel like there could be a better way since I'm not using an argument here.
4
Views
Open in Slack
Previous
Next