Guest User

Untitled

a guest
Jul 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public class Container<T> {
  2. private final T inner;
  3.  
  4. public Container(final T inner) {
  5. this.inner = inner;
  6. }
  7.  
  8. public <R> Container<R> map(final Function<T,R> f) {
  9. return lift(f).apply(this);
  10. }
  11.  
  12. public <R> Function<Container<T>, Container<R>> lift(final Function<T,R> f) {
  13. return containerT -> new Container(f.apply(containerT.inner));
  14. }
  15. }
Add Comment
Please, Sign In to add comment