Reputation: 13585
It does not make sense but this groovy is behaving absurd.
Code is like this:
def xmlArray = xmlMap['ClientXml'] //Map has key and array of xml for each key.
println "Length of Array"
println xmlArray.length //prints [, ,]
println xmlArray.size() //prints 3
println groovy.xml.XmlUtil.serialize(xmlArray[1] ) //prints xml
println xmlArray.getClass().name //prints java.util.ArrayList
//This part does not work
xmlArray.each {
println it
}
Not sure what got changed in my code but it was workng fine before.
Upvotes: 3
Views: 3888
Reputation: 6927
I have no deeper insight to offer except that rewriting the loop as for (element in array) { ... }
was a sufficent solution for me (and I usually prefer that notation anyway)...
Upvotes: 1