@Test public void optional() { assertAll( () -> assertEquals(Either.right("1"), optionalHead.getOrModify(list12)), () -> assertEquals(Either.left(ImmutableList.empty()), optionalHead.getOrModify(ImmutableList.empty())), () -> assertEquals(Option.some("1"), optionalHead.getOption(list12)), () -> assertEquals(Option.none(), optionalHead.getOption(ImmutableList.empty())), () -> assertEquals(ImmutableList.of("3", "2"), optionalHead.set(list12, "3")), () -> assertEquals(ImmutableList.empty(), optionalHead.set(ImmutableList.empty(), "3")), () -> assertEquals(ImmutableList.of("11", "2"), optionalHead.modify(list12, a -> a + a)), () -> assertEquals(ImmutableList.empty(), optionalHead.modify(ImmutableList.empty(), a -> a + a)), () -> assertEquals(Option.some(ImmutableList.of("11", "2")), optionalHead.modifyOption(list12, a -> a + a)), () -> assertEquals(Option.none(), optionalHead.modifyOption(ImmutableList.empty(), a -> a + a)) ); }
protected Optional(POptional<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); }
Optional { protected Optional(POptional<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } }
Optional { protected Optional(POptional<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Optional(POptional<S, S, A, A> delegate); }
Optional { protected Optional(POptional<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Optional(POptional<S, S, A, A> delegate); static Optional<S, A> of(Function2<S, A, S> set, Function1<S, Option<A>> getOption); Function1<A, S> set(S target); S set(S target, A value); Either<S, A> getOrModify(S target); Option<A> getOption(S target); Operator1<S> lift(Operator1<A> mapper); S modify(S target, Operator1<A> mapper); Option<S> modifyOption(S target, Operator1<A> mapper); Optional<S, B> compose(Optional<A, B> other); Optional<S, B> compose(Iso<A, B> other); Optional<S, B> compose(Prism<A, B> other); Optional<S, B> compose(Lens<A, B> other); }
Optional { protected Optional(POptional<S, S, A, A> delegate) { this.delegate = checkNonNull(delegate); } protected  Optional(POptional<S, S, A, A> delegate); static Optional<S, A> of(Function2<S, A, S> set, Function1<S, Option<A>> getOption); Function1<A, S> set(S target); S set(S target, A value); Either<S, A> getOrModify(S target); Option<A> getOption(S target); Operator1<S> lift(Operator1<A> mapper); S modify(S target, Operator1<A> mapper); Option<S> modifyOption(S target, Operator1<A> mapper); Optional<S, B> compose(Optional<A, B> other); Optional<S, B> compose(Iso<A, B> other); Optional<S, B> compose(Prism<A, B> other); Optional<S, B> compose(Lens<A, B> other);  }