Sunday, January 31, 2010

Groovy operators

These operators are very powerful:
If you have two lists and want to subtract one list from another:
myList = myList - yourList // requires that both lists have same type of elements.


Intersection
userIds.intersect(usersWithPermissions)


Split a name-value pair string to make it a String[]
String [] pair = someString.split(":") // now pair[0] = key and pair[1] = value

No comments: