Class FlowableOperatorConditionalConcat<T,C>

java.lang.Object
org.aksw.commons.rx.op.FlowableOperatorConditionalConcat<T,C>
Type Parameters:
T - Item type
K - Group key type
V - Accumulator type
All Implemented Interfaces:
io.reactivex.rxjava3.core.FlowableOperator<T,T>

public final class FlowableOperatorConditionalConcat<T,C> extends Object implements io.reactivex.rxjava3.core.FlowableOperator<T,T>
Track all seen items of the downstream flowable. When the downstream completes, invoke an action that creates a new publisher based on the seen items that will be concatenated.

 		Flowable<Entry<Integer, List<Integer>>> list = Flowable
			.range(0, 10)
			.map(i -> Maps.immutableEntry((int)(i / 3), i))
			.lift(FlowableOperatorSequentialGroupBy.<Entry<Integer, Integer>, Integer, List<Integer>>create(Entry::getKey, ArrayList::new, (acc, e) -> acc.add(e.getValue())));

 
Author:
raven
  • Field Details

    • aggregator

      protected Aggregator<T,?,C> aggregator
      The amount of items to read ahead
    • tailFlowFactory

      protected Function<? super C,io.reactivex.rxjava3.core.Flowable<T>> tailFlowFactory
  • Constructor Details

    • FlowableOperatorConditionalConcat

      public FlowableOperatorConditionalConcat(Aggregator<T,?,C> aggregator, Function<? super C,io.reactivex.rxjava3.core.Flowable<T>> tailFlowFactory)
  • Method Details

    • create

      public static <T, C> FlowableOperatorConditionalConcat<T,C> create(Aggregator<T,?,C> aggregator, Function<C,io.reactivex.rxjava3.core.Flowable<T>> tailFlowFactory)
      Create method with the following characteristics:
      • the accumulator constructor is a mere supplier (and thus neither depends on the accumulator count nor the group Key)
      • Group keys are compared using Objects::equals
    • apply

      public org.reactivestreams.Subscriber<? super T> apply(org.reactivestreams.Subscriber<? super T> downstream) throws Exception
      Specified by:
      apply in interface io.reactivex.rxjava3.core.FlowableOperator<T,C>
      Throws:
      Exception