public class ContextStreamCombiner extends AbstractStream<Context>
Context
objects and produces a
new stream of Context
s which contain the stream values from both
input streams. To combine contexts, prefix strings are added to all the keys
to ensure that there is no overlap. The key prefixes can be empty if it is
known that the context keys will not collide. The two streams are consumed in
two threads which the next()
method waits to complete before
returning.Constructor and Description |
---|
ContextStreamCombiner(Stream<Context> a,
Stream<Context> b)
Construct the combiner to consume the two given streams.
|
ContextStreamCombiner(Stream<Context> a,
Stream<Context> b,
String aprefix,
String bprefix)
Construct the combiner to consume the two given streams, using the given
prefixes to modify the keys from the respective streams.
|
Modifier and Type | Method and Description |
---|---|
static Stream<Context> |
combine(Stream<Context> a,
Stream<Context> b)
Utility method to combine two streams.
|
boolean |
hasNext() |
Context |
next() |
filter, forEach, forEach, forEach, iterator, map, map, parallelForEach, parallelForEach, remove, transform
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
forEach, spliterator
public ContextStreamCombiner(Stream<Context> a, Stream<Context> b)
Stream
will be prefixed "a" and the second "b".a
- the first streamb
- the second streampublic ContextStreamCombiner(Stream<Context> a, Stream<Context> b, String aprefix, String bprefix)
a
- the first streamb
- the second streamaprefix
- the first stream key prefixbprefix
- the second stream key prefixpublic boolean hasNext()