CLOSE FULL VIEW
Groovy: Best Practices Developed From Distributed Polyglot Programming
Recorded at:
Community comments
About Groovy Gotchas
by
Sargis Harutyunyan
Posted
Avoid list.each{}, prefer for (a in list)
by
Olivier Gourment
Posted
About Groovy Gotchas
by
Sargis Harutyunyan
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
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





Hello stranger!
You need to Register an InfoQ account or Login to post comments. But there's so much more behind being registered.Get the most out of the InfoQ experience.
Tell us what you think