| Modifier and Type | Method and Description |
|---|---|
Optional<Either<L,R>> |
filter(Predicate<L> predicate) |
void |
forEach(Consumer<? super L> consumer)
Executes the given side-effecting function if this is a Left
|
<X> Either<X,R> |
map(Function<L,X> mapper)
The given function is applied if this is a Left.
|
L |
orElse(L other) |
L |
orElseGet(Supplier<L> supplier) |
<X extends Exception> |
orElseThrow(Function<R,X> exceptionMapper) |
Either<L,R> |
peek(Consumer<? super L> consumer)
Executes the given side-effecting function if this is a Left and returns this Either
|
Optional<L> |
toOptional() |
public <X> Either<X,R> map(Function<L,X> mapper)
X - the resulting type of applying the functionmapper - the function to apply if this is a Leftpublic Optional<Either<L,R>> filter(Predicate<L> predicate)
predicate - the predicatepublic Either<L,R> peek(Consumer<? super L> consumer)
consumer - the consumerpublic void forEach(Consumer<? super L> consumer)
consumer - the consumerpublic Optional<L> toOptional()
public L orElse(L other)
other - otherpublic L orElseGet(Supplier<L> supplier)
supplier - supplierpublic <X extends Exception> L orElseThrow(Function<R,X> exceptionMapper) throws X extends Exception
X - Type of the exception to be thrownexceptionMapper - The function which will return the exception to be thrownX - if this is a RightNullPointerException - if no value is present and exceptionSupplier is nullX extends ExceptionCopyright © 2014–2016. All rights reserved.