| Modifier and Type | Method and Description |
|---|---|
static <T> Collector<T,?,Double> |
averaging(Function<? super T,Double> mapper)
Returns a
Collector that calculates average of input elements. |
static <T,A,IR,OR> |
collectingAndThen(Collector<T,A,IR> c,
Function<IR,OR> finisher)
Returns a
Collector that performs additional transformation. |
static <T> Collector<T,?,Long> |
counting()
Returns a
Collector that counts the number of input elements. |
static <T,K> Collector<T,?,Map<K,List<T>>> |
groupingBy(Function<? super T,? extends K> classifier)
Returns a
Collector that performs grouping operation by given classifier. |
static <T,K,A,D> Collector<T,?,Map<K,D>> |
groupingBy(Function<? super T,? extends K> classifier,
Collector<? super T,A,D> downstream)
Returns a
Collector that performs grouping operation by given classifier. |
static <T,K,D,A,M extends Map<K,D>> |
groupingBy(Function<? super T,? extends K> classifier,
Supplier<M> mapFactory,
Collector<? super T,A,D> downstream)
Returns a
Collector that performs grouping operation by given classifier. |
static Collector<CharSequence,?,String> |
joining()
Returns a
Collector that concatenates input elements into new string. |
static Collector<CharSequence,?,String> |
joining(CharSequence delimiter)
Returns a
Collector that concatenates input elements into new string. |
static Collector<CharSequence,?,String> |
joining(CharSequence delimiter,
CharSequence prefix,
CharSequence suffix)
Returns a
Collector that concatenates input elements into new string. |
static Collector<CharSequence,?,String> |
joining(CharSequence delimiter,
CharSequence prefix,
CharSequence suffix,
String emptyValue)
Returns a
Collector that concatenates input elements into new string. |
static <T,U,A,R> Collector<T,?,R> |
mapping(Function<? super T,? extends U> mapper,
Collector<? super U,A,R> downstream)
Returns a
Collector that performs mapping function before accumulation. |
static <T,R> Collector<T,?,R> |
reducing(R identity,
Function<? super T,? extends R> mapper,
BinaryOperator<R> op)
Returns a
Collector that reduces the input elements. |
static <T> Collector<T,?,T> |
reducing(T identity,
BinaryOperator<T> op)
Returns a
Collector that reduces the input elements. |
static <T,R extends Collection<T>> |
toCollection(Supplier<R> collectionSupplier)
Returns a
Collector that fills new Collection, provided by collectionSupplier, with input elements. |
static <T> Collector<T,?,List<T>> |
toList()
Returns a
Collector that fills new List with input elements. |
static <T,K,V> Collector<T,?,Map<K,V>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper)
Returns a
Collector that fills new Map with input elements. |
static <T,K,V,M extends Map<K,V>> |
toMap(Function<? super T,? extends K> keyMapper,
Function<? super T,? extends V> valueMapper,
Supplier<M> mapFactory)
Returns a
Collector that fills new List with input elements. |
static <T> Collector<T,?,Set<T>> |
toSet()
Returns a
Collector that fills new Set with input elements. |
public static <T,R extends Collection<T>> Collector<T,?,R> toCollection(Supplier<R> collectionSupplier)
Collector that fills new Collection, provided by collectionSupplier, with input elements.T - the type of the input elementsR - the type of the resulting collectioncollectionSupplier - a supplier function that provides new collectionCollectorpublic static <T> Collector<T,?,List<T>> toList()
Collector that fills new List with input elements.T - the type of the input elementsCollectorpublic static <T> Collector<T,?,Set<T>> toSet()
Collector that fills new Set with input elements.T - the type of the input elementsCollectorpublic static <T,K,V> Collector<T,?,Map<K,V>> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper)
Collector that fills new Map with input elements.T - the type of the input elementsK - the result type of key mapping functionV - the result type of value mapping functionkeyMapper - a mapping function to produce keysvalueMapper - a mapping function to produce valuesCollectorpublic static <T,K,V,M extends Map<K,V>> Collector<T,?,M> toMap(Function<? super T,? extends K> keyMapper, Function<? super T,? extends V> valueMapper, Supplier<M> mapFactory)
Collector that fills new List with input elements.T - the type of the input elementsK - the result type of key mapping functionV - the result type of value mapping functionM - the type of the resulting MapkeyMapper - a mapping function to produce keysvalueMapper - a mapping function to produce valuesmapFactory - a supplier function that provides new MapCollectorpublic static Collector<CharSequence,?,String> joining()
Collector that concatenates input elements into new string.Collectorpublic static Collector<CharSequence,?,String> joining(CharSequence delimiter)
Collector that concatenates input elements into new string.delimiter - the delimeter between each elementCollectorpublic static Collector<CharSequence,?,String> joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix)
Collector that concatenates input elements into new string.delimiter - the delimeter between each elementprefix - the prefix of resultsuffix - the suffix of resultCollectorpublic static Collector<CharSequence,?,String> joining(CharSequence delimiter, CharSequence prefix, CharSequence suffix, String emptyValue)
Collector that concatenates input elements into new string.delimiter - the delimeter between each elementprefix - the prefix of resultsuffix - the suffix of resultemptyValue - the string which replaces empty element if existsCollectorpublic static <T> Collector<T,?,Double> averaging(Function<? super T,Double> mapper)
Collector that calculates average of input elements.T - the type of the input elementsmapper - the mapping function which extracts value from element to calculate resultCollectorpublic static <T> Collector<T,?,Long> counting()
Collector that counts the number of input elements.T - the type of the input elementsCollectorpublic static <T> Collector<T,?,T> reducing(T identity, BinaryOperator<T> op)
Collector that reduces the input elements.T - the type of the input elementsidentity - the initial valueop - the operator to reduce elementsCollectorreducing(java.lang.Object, com.annimon.stream.function.Function, com.annimon.stream.function.BinaryOperator)public static <T,R> Collector<T,?,R> reducing(R identity, Function<? super T,? extends R> mapper, BinaryOperator<R> op)
Collector that reduces the input elements.T - the type of the input elementsR - the type of the output elementsidentity - the initial valuemapper - the mapping functionop - the operator to reduce elementsCollectorreducing(java.lang.Object, com.annimon.stream.function.BinaryOperator)public static <T,U,A,R> Collector<T,?,R> mapping(Function<? super T,? extends U> mapper, Collector<? super U,A,R> downstream)
Collector that performs mapping function before accumulation.T - the type of the input elementsU - the result type of mapping functionA - the accumulation typeR - the result type of collectormapper - a function that performs mapping to input elementsdownstream - the collector of mapped elementsCollectorpublic static <T,A,IR,OR> Collector<T,A,OR> collectingAndThen(Collector<T,A,IR> c, Function<IR,OR> finisher)
Collector that performs additional transformation.T - the type of the input elementsA - the accumulation typeIR - the input type of transformation functionOR - the output type of transformation functionc - the input Collectorfinisher - the final transformation functionCollectorpublic static <T,K> Collector<T,?,Map<K,List<T>>> groupingBy(Function<? super T,? extends K> classifier)
Collector that performs grouping operation by given classifier.T - the type of the input elementsK - the type of the keysclassifier - the classifier functionCollectorgroupingBy(com.annimon.stream.function.Function, com.annimon.stream.Collector),
groupingBy(com.annimon.stream.function.Function, com.annimon.stream.function.Supplier, com.annimon.stream.Collector)public static <T,K,A,D> Collector<T,?,Map<K,D>> groupingBy(Function<? super T,? extends K> classifier, Collector<? super T,A,D> downstream)
Collector that performs grouping operation by given classifier.T - the type of the input elementsK - the type of the keysA - the accumulation typeD - the result type of downstream reductionclassifier - the classifier functiondownstream - the collector of mapped elementsCollectorgroupingBy(com.annimon.stream.function.Function),
groupingBy(com.annimon.stream.function.Function, com.annimon.stream.function.Supplier, com.annimon.stream.Collector)public static <T,K,D,A,M extends Map<K,D>> Collector<T,?,M> groupingBy(Function<? super T,? extends K> classifier, Supplier<M> mapFactory, Collector<? super T,A,D> downstream)
Collector that performs grouping operation by given classifier.T - the type of the input elementsK - the type of the keysA - the accumulation typeD - the result type of downstream reductionM - the type of the resulting Mapclassifier - the classifier functionmapFactory - a supplier function that provides new Mapdownstream - the collector of mapped elementsCollectorgroupingBy(com.annimon.stream.function.Function),
groupingBy(com.annimon.stream.function.Function, com.annimon.stream.Collector)Copyright © 2015. All rights reserved.