functionalj.stream.StreamElementProcessor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of functionalj-core Show documentation
Show all versions of functionalj-core Show documentation
The module for FunctionalJ Core.
package functionalj.stream;
import functionalj.function.Func1;
import lombok.val;
public interface StreamElementProcessor {
void processElement (long index, F element);
T processComplete(long count);
default StreamElementProcessor of(Func1 mapper) {
return new StreamElementProcessor() {
@Override
public void processElement(long index, S source) {
val element = mapper.apply(source);
StreamElementProcessor.this.processElement(index, element);
}
@Override
public T processComplete(long count) {
return StreamElementProcessor.this.processComplete(count);
}
};
}
}