Note: This Repository will be no longer maintained. (Due to confusing name & Neither defection)
Consider using Union;
Easy implementation of Union class-like something
EitherOf.class is the one and only instance provider.
Returns instance with left value.
Either<Long, String> either = EitherOf.left(1L);
Returns instance with right value.
Either<Long, String> either = EitherOf.right("abc");
Returns instance without any value.
Either<Leng, String> neither = EitherOf.none();
Use this in case you need to declare type explicitly.
EitherOf.l(1L).<String>r();
Use this in case you need to declare type explicitly.
EitherOf.r("abc").<Long>l();
- left(): L
- right(): R
- leftOptional(): Optional
- rightOptional(): Optional
- hasLeft(): boolean
- hasRight(): boolean
- asJoined(Function<? super L, ? extends O>, Function<? super R, ? extends O>): O
- asJoined(BiFunction<? super L, ? super R, ? extends O>): O
- asJoinedOptional(Function<? super L, ? extends O>, Function<? super R, ? extends O>): Optional
- asJoinedOptional(BiFunction<? super L, ? super R, ? extends O>): Optional
- acceptWith(Consumer<? super L>, Consumer<? super R>): void
- acceptWith(BiConsumer<? super L, ? super R>): void
- acceptLeftWith(Consumer<? super L>): void
- acceptRightWith(Consumer<? super R>): void
- peekWith(Consumer<? super L>, Consumer<? super R>): Either<L, R>
- peekWith(BiConsumer<? super L, ? super R>): Either<L, R>
- peekLeftWith(Consumer<? super L>): Either<L, R>
- peekRightWith(Consumer<? super R>): Either<L, R>