in python:
>>> from collections import defaultdict
>>> map = defaultdict(int)
>>> for word in ['hi', 'there', 'hi']:
... map[word] += 1
I am glad Java has this stuff now, but it's a little surprising that its tools are still so obtuse relative to competitors.edit: I should have foreseen the derailment caused by and nitpicking to follow a comment like this. Sorry folks!