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

functionalj.stream.StreamProcessor Maven / Gradle / Ivy

package functionalj.stream;

import functionalj.function.Func1;
import lombok.val;

public interface StreamProcessor {
    
    public static  StreamProcessor from(Func1, T> mapper) {
        return s -> mapper.apply(s);
    }
    
    
    public TARGET process(StreamPlus stream);
    
    
    default  StreamProcessor of(Func1 mapper) {
        return new StreamProcessor() {
            @Override
            public TARGET process(StreamPlus stream) {
                val dataStream = stream.map(mapper);
                val target     = StreamProcessor.this.process(dataStream);
                return target;
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy