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