Map<String, Integer> dict = new HashMap<String, Integer>();
dict.put("a", 1);
dict.put("b", 2);
for (Map.Entry<String, Integer> entry : dict) {
System.out.println(entry.getKey() + " " + entry.getValue());
if (entry.getKey().equals("a")) {
System.out.println("Look mom, braces!");
}
}
ftfy.
Yes, Java is quite verbose, partly because it is a statically typed language, and we could discuss the drawbacks and benefits of that for weeks. It has its advantages though, not least of which is that it's significantly faster (around half as fast as C++, as far as I know), and way better documented than Python. I think it's in fact one of the best documented languages / standard libraries around, which is worth a lot.