functionalj.stream.DoubleStreamElementProcessor 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 java.util.function.ToDoubleFunction;
import lombok.val;
public interface DoubleStreamElementProcessor {
void processElement (long index, double element);
T processComplete(long count);
default StreamElementProcessor of(ToDoubleFunction mapper) {
return new StreamElementProcessor() {
@Override
public void processElement(long index, S source) {
val element = mapper.applyAsDouble(source);
DoubleStreamElementProcessor.this.processElement(index, element);
}
@Override
public T processComplete(long count) {
return DoubleStreamElementProcessor.this.processComplete(count);
}
};
}
}