Chapter 7[ 161 ]The following result is a quick and nasty UI for Twitter searching:
Method pointers
Groovy allows you to assign a method to a closure by using the & syntax. The closure
returned is often referred to as a method pointer. Method pointers can be assigned
by dereferencing the method name from any object instance, for example:
given:
def list = ["A", "B", "C"]when:
def addToList = list.&addand:
addToList "D"then:
list == ["A", "B", "C", "D"]