Is there a more streamlined way to do the following?
Map map = new HashMap(); map.put(\"a\", \"apple\"); map.put(
You could always use double brace initialization:
Map map = new HashMap() {{ put("foo", "bar"); put("baz", "qux"); }}
But bear in mind this might not be efficient according to these answers.