Java:
List<String> firstNames = new ArrayList<String>();
for(Person p : people) {
firstNames.add(p.getFirstName());
}
addCallback(new Runnable() {
public void run() {
doSomething();
}
});
Python: first_names = [p.first_name for p in people]
add_callback(do_something)
Scala: val firstNames = people.map((p) => p.firstName);
addCallback(() => doSomething());
The Python and Scala versions do exactly what they say, while the Java code has a bunch of boilerplate that you have to mentally filter out before you can understand what it's doing. And the Scala code is fully typesafe; the compiler infers types rather than making you continually repeat them.