public class Lambdas extends Object
|Modifier and Type||Method and Description|
Can be used to group a given stream by identity and count the occurrences of each entity.
Used to collect the results of a stream operation into an existing collection.
Provides an identity function which permits to "touch" the element for which it was called.
Can be used as lambda for unsupported BiOperations.
This is designed to be used with
Optional like this:
return Optional.of("Test").map(Lambdas.touch(s -> System.out.println(s)))
T- the type of the elements accepted by the consumer
consumer- the lambda used to "touch" (use) each parameter
public static <T,C extends Collection<T>> Collector<T,?,C> into(C collection)
T- the type of the elements accepted by the collector
C- the type of the collection which is filled by the collector
collection- the target collection
Collectorinserting all elements into the given collection
K- the type of the key by which the values are grouped
public static <O> O unsupportedBiOperation(O a, O b)
This is intended to be a dummy parameter (e.g. for Collector.of. It will always throw an UnsupportedOperationException if invoked.
O- the type of objects for which the operation is to be used
a- the first parameter of the binary operation
b- the second parameter of the binary operation
UnsupportedOperationException- always thrown by this method
Copyright © 2018. All rights reserved.