public static class Maybe.Nothing<T> extends java.lang.Object implements Maybe<T>
Maybe.Just<T>, Maybe.Lazy<T>, Maybe.Nothing<T>
Applicativable.Applicatives, Applicativable.SemigroupApplyer<T>
Constructor and Description |
---|
Nothing() |
Modifier and Type | Method and Description |
---|---|
Maybe<T> |
filter(java.util.function.Predicate<? super T> test)
Keep only elements for which the supplied predicates hold
e.g.
|
<R> Maybe<R> |
flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper) |
T |
get() |
boolean |
isPresent() |
<R> Maybe<R> |
map(java.util.function.Function<? super T,? extends R> mapper)
Transform this functor using the supplied transformation function
|
Maybe<T> |
recover(java.util.function.Supplier<T> value) |
Maybe<T> |
recover(T value) |
java.util.Optional<T> |
toOptional() |
java.lang.String |
toString() |
<R> R |
visit(java.util.function.Function<? super T,? extends R> some,
java.util.function.Supplier<? extends R> none) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
accumulateJust, accumulateJust, accumulateJust, cast, coflatMap, combine, filterNot, fromEvalOf, fromIterable, fromOptional, just, narrow, nest, none, notNull, of, ofNullable, ofType, patternMatch, peek, sequence, toMaybe, trampoline, unit
anyM
ap, ap, ap1, ap2, ap3, ap4, ap5
iterator
matches
public <R> Maybe<R> map(java.util.function.Function<? super T,? extends R> mapper)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]
map
in interface Maybe<T>
map
in interface ConvertableFunctor<T>
map
in interface Functor<T>
map
in interface MonadicValue<T>
map
in interface MonadicValue1<T>
mapper
- Transformation functionpublic <R> Maybe<R> flatMap(java.util.function.Function<? super T,? extends MonadicValue<? extends R>> mapper)
public Maybe<T> filter(java.util.function.Predicate<? super T> test)
Filterable
of(1,2,3).filter(i->i>2);
//[3]
public T get()
get
in interface Convertable<T>
get
in interface java.util.function.Supplier<T>
public <R> R visit(java.util.function.Function<? super T,? extends R> some, java.util.function.Supplier<? extends R> none)
public java.util.Optional<T> toOptional()
toOptional
in interface Matchable.MatchableOptional<T>
toOptional
in interface Matchable.ValueAndOptionalMatcher<T>
toOptional
in interface Convertable<T>
public java.lang.String toString()
toString
in class java.lang.Object