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