I am wondering why the second map declaration (using the diamond operator) does not compile when the first one does. Compilation error:
error: cannot
Diamond inference doesn't work for instantiating anonymous classes, which is what you're doing here.
Try this:
Map map1 = new HashMap<>(); { map1.put("abc", "abc"); }