About the conference

QCon is a conference that is organized by the community, for the community.The result is a high quality conference experience where a tremendous amount of attention and investment has gone into having the best content on the most important topics presented by the leaders in our community.QCon is designed with the technical depth and enterprise focus of interest to technical team leads, architects, and project managers.
Community comments
About Groovy Gotchas
by Sargis Harutyunyan /
Avoid list.each{}, prefer for (a in list)
by Olivier Gourment /
About Groovy Gotchas
by Sargis Harutyunyan /
Your message is awaiting moderation. Thank you for participating in the discussion.
I tried for Groovy 1.7.3(GroovyConsole) and have following:
class Name {
String id = "Sargis"
}
def name = new Name()
println name.id
println name.getId()
println name['id']
def c = 1
println c.getClass().getName()
def b = 1.1
println b.getClass().getName()
def a = 1.1d
println a.getClass().getName()
============================================================================
Output
groovy> class Name {
groovy> String id = "Sargis"
groovy> }
groovy> def name = new Name()
groovy> println name.id
groovy> println name.getId()
groovy> println name['id']
groovy> def c = 1
groovy> println c.getClass().getName()
groovy> def b = 1.1
groovy> println b.getClass().getName()
groovy> def a = 1.1d
groovy> println a.getClass().getName()
Sargis
Sargis
Sargis
java.lang.Integer
java.math.BigDecimal
java.lang.Double
seems everything is ok
Avoid list.each{}, prefer for (a in list)
by Olivier Gourment /
Your message is awaiting moderation. Thank you for participating in the discussion.
Good tip, thanks Jonathan!