All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.aksw.commons.rx.util.RxOpsEx Maven / Gradle / Ivy

package org.aksw.commons.rx.util;

import org.aksw.commons.collector.domain.Accumulator;
import org.aksw.commons.collector.domain.Aggregator;

import io.reactivex.rxjava3.core.Flowable;
import io.reactivex.rxjava3.core.FlowableTransformer;

public class RxOpsEx {

    public static  FlowableTransformer wrap(Aggregator aggregator) {
        return upstream -> {
            Accumulator accumulator = aggregator.createAccumulator();
            upstream.forEach(accumulator::accumulate);
            return Flowable.just(accumulator.getValue());
        };
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy