Package ch.tocco.nice2.toolbox.api.util
Class StreamUtils
java.lang.Object
ch.tocco.nice2.toolbox.api.util.StreamUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Predicate
<T> distinctByKey
(Function<? super T, Object> keyExtractor) uniqueByFunction
(Function<I, K> uniqueFunction) collects elements if the result of feeding them through a given function has not already been encountered the order of elements is preserved, so the first element for each occurrence is collected
-
Method Details
-
distinctByKey
-
uniqueByFunction
collects elements if the result of feeding them through a given function has not already been encountered the order of elements is preserved, so the first element for each occurrence is collected- Type Parameters:
I
- the type of the streamK
- the type of the result of the function- Parameters:
uniqueFunction
- the function whose result should be checked for uniqueness- Returns:
- the collector
-