Try Groovy!
def foos = [ new Foo(2), new Foo(4) ] def foos = [ new Foo(2), new Foo(4) ]There's also this classic bug:
def printOne(Collection c) {
if (c.empty) {
print("Collection is empty")
} else {
print(c.iterator().next())
}
}
Can you spot the bug? This code works for all Collections... except Maps. If c is a Map, Groovy translates c.empty to c.get("empty"). Constantly having to be on my toes to avoid stuff like that is a pain.