Module org.tquadrat.foundation.base
Class ZippingSpliterator<L,R,O>
java.lang.Object
org.tquadrat.foundation.stream.internal.ZippingSpliterator<L,R,O>
- Type Parameters:
L- The type over which the "left" stream is streaming.R- The type over which the "right" stream is streaming.O- The type created by the combiner out of pairs of "left" and "right" values, over which the resulting stream streams.
- All Implemented Interfaces:
Spliterator<O>
@ClassVersion(sourceVersion="$Id: ZippingSpliterator.java 1060 2023-09-24 19:21:40Z tquadrat $")
@API(status=INTERNAL,
since="0.0.7")
public final class ZippingSpliterator<L,R,O>
extends Object
implements Spliterator<O>
An implementation of
Spliterator
that zips two streams into one.- Author:
- Dominic Fox
- Modified by:
- Thomas Thrien (thomas.thrien@tquadrat.org)
- Version:
- $Id: ZippingSpliterator.java 1060 2023-09-24 19:21:40Z tquadrat $
- Since:
- 0.0.7
- UML Diagram
-
UML Diagram for "org.tquadrat.foundation.stream.internal.ZippingSpliterator"
-
Nested Class Summary
Nested classes/interfaces inherited from interface java.util.Spliterator
Spliterator.OfDouble, Spliterator.OfInt, Spliterator.OfLong, Spliterator.OfPrimitive<T,T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BiFunction<L, R, O> The combiner function.private final Spliterator<L> The left-hand source.private booleanFlag the indicates whether the right-hand source has the next value.private final Spliterator<R> The right-hand source.Fields inherited from interface java.util.Spliterator
CONCURRENT, DISTINCT, IMMUTABLE, NONNULL, ORDERED, SIZED, SORTED, SUBSIZED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateZippingSpliterator(Spliterator<L> lefts, Spliterator<R> rights, BiFunction<L, R, O> combiner) Creates a newZippingSpliteratorinstance. -
Method Summary
Modifier and TypeMethodDescriptionfinal intfinal longfinal booleantryAdvance(Consumer<? super O> action) final Spliterator<O> trySplit()static final <L,R, O> Spliterator <O> zipping(Spliterator<L> lefts, Spliterator<R> rights, BiFunction<L, R, O> combiner) Factory for instances ofZippingSpliterator.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Spliterator
forEachRemaining, getComparator, getExactSizeIfKnown, hasCharacteristics
-
Field Details
-
m_Combiner
The combiner function. -
m_Lefts
The left-hand source. -
m_RightHadNext
Flag the indicates whether the right-hand source has the next value. -
m_Rights
The right-hand source.
-
-
Constructor Details
-
ZippingSpliterator
Creates a newZippingSpliteratorinstance.- Parameters:
lefts- The left-hand source.rights- The right-hand source.combiner- The combiner.
-
-
Method Details
-
characteristics
- Specified by:
characteristicsin interfaceSpliterator<L>
-
estimateSize
- Specified by:
estimateSizein interfaceSpliterator<L>
-
tryAdvance
- Specified by:
tryAdvancein interfaceSpliterator<L>
-
trySplit
- Specified by:
trySplitin interfaceSpliterator<L>
-
zipping
public static final <L,R, Spliterator<O> zippingO> (Spliterator<L> lefts, Spliterator<R> rights, BiFunction<L, R, O> combiner) Factory for instances ofZippingSpliterator.- Type Parameters:
L- The type over which the "left" stream is streaming.R- The type over which the "right" stream is streaming.O- The type created by the combiner out of pairs of "left" and "right" values, over which the resulting stream streams.- Parameters:
lefts- The left-hand source.rights- The right-hand source.combiner- The combiner.- Returns:
- The new instance.
-
