Guest User

Untitled

a guest
Dec 12th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.25 KB | None | 0 0
  1. public class Functor<T> {
  2. private final T value;
  3. public Functor(T value) {
  4. this.value = value;
  5. }
  6. public <U> Functor<U> map(Function<T, U> mapperFunction) {
  7. return new Functor<>(mapperFunction.apply(value)); // Functor wrapping f(x)
  8. }
  9. }
Add Comment
Please, Sign In to add comment