What is Groovy's alternative for Java 8's .map()?
Example:
List<String> codes = events
.stream()
.map(event -> event.getCode())
.collect(Collectors.toList());
I was trying to do
events.each { it; return it.getCode() }.collect() as String[]
but I am getting List of Strings, but toString() representation instead of code