Class TransformCollector<T,U>
java.lang.Object
com.github.martincooper.datatable.TransformCollector<T,U>
- Type Parameters:
T- The collection type.U- The return type.
TransformCollector. Custom Collector.
Used to pass the contents of a collection to a
single method, returning a single value.
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.stream.Collector
Collector.Characteristics -
Constructor Summary
ConstructorsConstructorDescriptionTransformCollector(Function<io.vavr.collection.Stream<T>, U> function) TransformCollector constructor. -
Method Summary
Modifier and TypeMethodDescriptionThe accumulator.Default set of characteristics.combiner()finisher()The finisher has all the items in the list.supplier()The supplier.static <T,U> TransformCollector<T, U> as method.
-
Constructor Details
-
TransformCollector
TransformCollector constructor.- Parameters:
function- The function to run on the collected items.
-
-
Method Details
-
transform
public static <T,U> TransformCollector<T,U> transform(Function<io.vavr.collection.Stream<T>, U> function) as method. Static helper to return a new instance of the Transform Collector class.- Type Parameters:
T- The collection type.U- The return type.- Parameters:
function- The function to run on the full collection.- Returns:
- Returns a new instance of the collector.
-
supplier
The supplier. Returns a new ArrayList which builds up the final item list. -
accumulator
The accumulator. In this case, just append the item to the list. -
combiner
-
finisher
The finisher has all the items in the list. Now we just need to run the requested transform function on it to get the final results. -
characteristics
Default set of characteristics.
-