Package org.voltdb.stream.source
Class IterableSource<T>
java.lang.Object
org.voltdb.stream.source.GeneratorSource<T>
org.voltdb.stream.source.IterableSource<T>
- Type Parameters:
T
- the type of elements produced by this source.
- All Implemented Interfaces:
VoltLifecycle
,VoltStreamSource<T>
Generates a stream of data items from an
Iterable
.
Does not try to modify passed iterable. The iterable does not have to be thread safe. The user should assume it is not copied therefore should not modify it externally.
-
Field Summary
Fields inherited from class org.voltdb.stream.source.GeneratorSource
sourceTags
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> VoltStreamSource
<T> from
(Collection<T> given) Creates a source from the givenCollection
.protected boolean
hasNext()
A way for the implementation to indicate wheter there are more items to generate in the stream.static <T> VoltStreamSource
<T> iterate
(T... given) Creates a source from the provided elements.protected T
next()
Implementation should generate the next item in the stream.static VoltStreamSource
<Integer> range
(int start, int end) Creates a source that generates a range of integers fromstart
(inclusive) toend
(exclusive).Methods inherited from class org.voltdb.stream.source.GeneratorSource
configure, destroy, process
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.voltdb.stream.api.pipeline.VoltStreamSource
commit
-
Method Details
-
from
Creates a source from the givenCollection
.- Type Parameters:
T
- the type of elements in the collection- Parameters:
given
- the collection of elements to be streamed- Returns:
- a new instance of
IterableSource
containing the provided collection
-
iterate
Creates a source from the provided elements.- Type Parameters:
T
- the type of elements- Parameters:
given
- the elements to be streamed- Returns:
- a new instance of
IterableSource
containing the provided elements
-
range
Creates a source that generates a range of integers fromstart
(inclusive) toend
(exclusive).- Parameters:
start
- the starting integer of the range (inclusive)end
- the ending integer of the range (exclusive)- Returns:
- a new instance of
IterableSource
containing the specified range of integers
-
next
Description copied from class:GeneratorSource
Implementation should generate the next item in the stream.- Specified by:
next
in classGeneratorSource<T>
- Returns:
- the next item of type
T
-
hasNext
protected boolean hasNext()Description copied from class:GeneratorSource
A way for the implementation to indicate wheter there are more items to generate in the stream.- Specified by:
hasNext
in classGeneratorSource<T>
- Returns:
true
if there are more items to generate,false
otherwise
-