Skip to content

Instantly share code, notes, and snippets.

@nwillc
Created April 26, 2018 16:37
Show Gist options
  • Save nwillc/4153f6f204487d7354362d90e3933056 to your computer and use it in GitHub Desktop.
Save nwillc/4153f6f204487d7354362d90e3933056 to your computer and use it in GitHub Desktop.
Before util in Java
public class BeforeUtil {
static <T, R> Function<T, R> before(Consumer<T> before, Function<T, R> function) {
return arg -> {
before.accept(arg);
return function.apply(arg);
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment