Reputation: 1299
I am getting Exception evaluating SpringEL
expression when using java lambda operator.
example: list.stream().map(a -> a.toString()).reduce("",(a,b) -> a+b)
Upvotes: 2
Views: 3175
Reputation: 1260
Define a function similar to the following:
package com.mypackage;
public class CollectorsMap {
public static final List<String> name(Stream<AbstractName> stream) {
return stream.map(v->v.getName()).collect(Collectors.toList());
}
}
invoke it with something similar to the following (values is a list of values):
th:with="valueNames=${T(com.mypackage.CollectorsMap).name(values.stream())}"
This would return the list of name fields of the original list of objects.
Upvotes: 4