Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Last active December 18, 2015 08:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeaholicguy/bef3ad6c8fe630f865b1 to your computer and use it in GitHub Desktop.
Save codeaholicguy/bef3ad6c8fe630f865b1 to your computer and use it in GitHub Desktop.
@FunctionalInterface
public interface Function<T, R> {
R apply(T t);
// default method
default <V> Function<V, R> compose(Function<? super V, ? extends T> before);
default <V> Function<V, T> andThen(Function<? super R, ? extends V> after);
// static method
static <T> Function<T, T> identity() {
return t -> t;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment