Package com.mendix.utils
Class ListUtils
java.lang.Object
com.mendix.utils.ListUtils
A utility class providing a few shorthand functions for often used mapping functions in Java.
-
Method Summary
-
Method Details
-
map
This is a shorthand function for list.stream().map(mapper).collect(Collectors.toList()).- Type Parameters:
A
- The type of elements in the original listB
- The type of elements in the returning list- Parameters:
list
- The original listmapper
- The mapping function to apply to each item in the list- Returns:
- The new list with the mapping function applied to each item in the list
-
flatMap
This is a shorthand function for list.stream().flatMap(mapper.andThen(Collection::stream)).collect(Collectors.toList()).- Type Parameters:
A
- The type of elements in the original listB
- The type of elements in the returning list- Parameters:
list
- The original listmapper
- The mapping function to apply to each item in the list- Returns:
- The new list with the mapping function applied to each item in the list
-