groovy Accessing a property


Example

class Vector {
    double x
    double y
}
def points = [
    new Vector(x: 10, y: -5),
    new Vector(x: -17.5, y: 3),
    new Vector(x: -3.3, y: -1)
]

assert points*.x == [10, -17.5, -3.3]

Note: The * is optional. We could also write the above statement as in the below line and Groovy compiler would still be happy about it.

assert points.x == [10, -17.5, -3.3]