Package uk.co.terminological.rjava
Class RConverter.CollectingConverter<X,Y>
java.lang.Object
uk.co.terminological.rjava.RConverter.CollectingConverter<X,Y>
- Type Parameters:
X
- - source datatype which will usually be a java primitive type or similarY
- - target datatype which will usually be an RVector of some kind
- Enclosing class:
- RConverter
The ConvertingCollector interface allows us to reuse stream collectors for other non stream data types by
apply these to streams, iterators, arrays, collections, and iterables, as well as plain
instances. By default all of these conversions are handled through streams. The target data type is in our case usually
an RVector
- Author:
- terminological
-
Constructor Summary
ConstructorsConstructorDescriptionCollectingConverter
(Collector<X, ?, Y> collector) Instantiates a new collecting converter. -
Method Summary
Modifier and TypeMethodDescriptionConvert a iterable of type X to Y.convert
(Collection<X> collection) Convert a collection of type X to Y.Convert a iterator of type X to Y.Convert a stream of type X to Y.Convert an instance of type X to Y.Convert a array of type X to Y.static <A,
B> RConverter.CollectingConverter<A, B> Static constructor using a collector.
-
Constructor Details
-
CollectingConverter
Instantiates a new collecting converter.- Parameters:
collector
- the collector
-
-
Method Details
-
convert
Convert an instance of type X to Y.- Parameters:
instance
- a singleton of type X- Returns:
- a list or array
-
convert
Convert a stream of type X to Y.- Parameters:
stream
- a stream of type X- Returns:
- a list or array
-
convert
Convert a collection of type X to Y.- Parameters:
collection
- a collection of type X- Returns:
- a list or array
-
convert
Convert a iterable of type X to Y.- Parameters:
iterable
- the iterable- Returns:
- the y
-
convert
Convert a iterator of type X to Y.- Parameters:
iterator
- the iterator- Returns:
- the y
-
convert
Convert a array of type X to Y.- Parameters:
array
- the array- Returns:
- the y
-
from
Static constructor using a collector.- Type Parameters:
A
- the generic typeB
- the generic type- Parameters:
collector
- the collector- Returns:
- the collecting converter
-