Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Container<T> {
- private final T inner;
- public Container(final T inner) {
- this.inner = inner;
- }
- public <R> Container<R> map(final Function<T,R> f) {
- return lift(f).apply(this);
- }
- public <R> Function<Container<T>, Container<R>> lift(final Function<T,R> f) {
- return containerT -> new Container(f.apply(containerT.inner));
- }
- }
Add Comment
Please, Sign In to add comment