Created
June 14, 2016 20:35
-
-
Save rjeli/c1ca78c099febc60a37289f7089423f5 to your computer and use it in GitHub Desktop.
dumb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private class CountingLogger<T> implements Function<T, T> { | |
private int every; | |
private int count; | |
private Function<Integer,String> message; | |
public CountingLogger(int every, Function<Integer,String> message) { | |
this.every = every; | |
this.message = message; | |
this.count = 0; | |
} | |
@Override | |
public T apply(T t) { | |
if (count++ % every == 0) { | |
info(message.apply(count)); | |
} | |
return t; | |
} | |
} |
Author
rjeli
commented
Jun 15, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment