public static final class Maybe.Just<T> extends java.lang.Object implements Maybe<T>
Maybe.Just<T>, Maybe.Lazy<T>, Maybe.Nothing<T>
ApplicativeFunctor.Applicatives, ApplicativeFunctor.ApplyFunctions<T>
Constructor and Description |
---|
Just() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
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() |
int |
hashCode() |
boolean |
isPresent() |
<R> Maybe<R> |
map(java.util.function.Function<? super T,? extends R> mapper)
Transform this functor using the supplied transformation function
|
T |
orElse(T value)
Get the contained value or else the provided alternative
|
T |
orElseGet(java.util.function.Supplier<? extends T> value) |
Maybe<T> |
recover(java.util.function.Supplier<T> value) |
Maybe<T> |
recover(T value) |
java.lang.String |
toString() |
<R> R |
visit(java.util.function.Function<? super T,? extends R> some,
java.util.function.Supplier<? extends R> none) |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
accumulateJust, accumulateJust, accumulateJust, cast, coflatMap, combine, combineEager, filterNot, fromEvalOf, fromIterable, fromOptional, fromPublisher, just, narrow, nest, none, notNull, of, ofNullable, ofType, patternMatch, peek, sequence, sequence, sequenceJust, toMaybe, trampoline, unit, zip, zip, zip, zip, zip, zip, zip
anyM
applyFunctions
iterator, toOptional
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 <R> R visit(java.util.function.Function<? super T,? extends R> some, java.util.function.Supplier<? extends R> none)
visit
in interface Matchable.MatchableOptional<T>
visit
in interface Matchable.ValueAndOptionalMatcher<T>
visit
in interface Maybe<T>
visit
in interface Convertable<T>
visit
in interface Visitable<T>
public java.lang.String toString()
toString
in class java.lang.Object
public T get()
get
in interface Convertable<T>
get
in interface java.util.function.Supplier<T>
public boolean isPresent()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public T orElse(T value)
Convertable
orElse
in interface Convertable<T>
public T orElseGet(java.util.function.Supplier<? extends T> value)
orElseGet
in interface Convertable<T>