Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
List and Map constructor coercion in Groovy
import groovy.transform.Immutable
class Point {
double x, y
Point p1 = [1.23, 5.67]
assert p1.x == 1.23 && p1.y == 5.67
Point p2 = [y: 10, x: -1]
assert p2.x == -1 && p2.y == 10

This comment has been minimized.

Copy link
Owner Author

@glaforge glaforge commented Dec 2, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.