Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think the current way to write that is to either use Google Guave ImmutableMap.of("a", 1, "b", 2, "c", 3) or when mutable maps are required, to write: Map m = new HashMap() {{ put("a", 1); put("b", 2); put("c", 3); }};

Both of these are a bit lighter yet still far away from JavaScript or Ruby special syntaxes.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: