Im trying to use method reference in groovy. And I could not get it working.
The following is working in groovy.
Option2> list.stream().map(user -> user.getName()).collect(Collectors.toList())
What Im trying to achieve?
Option1> list.stream().map(User::getName).collect(Collectors.toList())
The above call is giving following error.
unexpected token: : @ line 33, column 14.
User::getName
1 error
Any suggestions how I can achieve?