Package org.dmfs.jems2.single
Class Collected<Value,Collection extends Collection<Value>>
java.lang.Object
org.dmfs.jems2.single.DelegatingSingle<Collection>
org.dmfs.jems2.single.Collected<Value,Collection>
- All Implemented Interfaces:
Fragile<Collection,,RuntimeException> Single<Collection>
public final class Collected<Value,Collection extends Collection<Value>>
extends DelegatingSingle<Collection>
A
Single holding the collected values of an Iterable.
This expects a generator which creates the initial (usually empty) collection and an Iterable which contains the values to collect.
Example
List<String> valueList = new Collected<>(ArrayList::new, values).value();
Set<String> valueSet = new Collected<>(HashSet::new, values).value();
-
Constructor Summary
ConstructorsConstructorDescriptionCollected(Generator<? extends Collection> collectionGenerator, Iterable<? extends Value> values) -
Method Summary
Methods inherited from class org.dmfs.jems2.single.DelegatingSingle
value
-
Constructor Details
-
Collected
public Collected(Generator<? extends Collection> collectionGenerator, Iterable<? extends Value> values)
-