Created
April 26, 2018 16:37
-
-
Save nwillc/4153f6f204487d7354362d90e3933056 to your computer and use it in GitHub Desktop.
Before util in Java
This file contains hidden or 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
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