| Constructor and Description |
|---|
Maybes() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
drop(Optional<T> optional)
Transforms a Optional.empty to null, a Optional.of to the wrapped
get.
|
static <T> Iterator<T> |
drops(Iterable<Optional<T>> iterable)
Creates an iterator transforming Maybes from the source iterable to
null when the source element is Nothing, to the wrapped get
otherwise.
|
static <T> Iterator<T> |
drops(Iterator<Optional<T>> iterator)
Creates an iterator transforming Maybes from the source iterator to
null when the source element is Nothing, to the wrapped get
otherwise.
|
static <T> Iterator<T> |
drops(Optional<T> first,
Optional<T> second)
Creates an iterator transformed passed elements such as the become
null when the source element is Nothing, the wrapped get otherwise.
|
static <T> Iterator<T> |
drops(Optional<T> first,
Optional<T> second,
Optional<T> third)
Creates an iterator transformed passed elements such as the become
null when the source element is Nothing, the wrapped get otherwise.
|
static <T> Optional<T> |
join(Optional<Optional<T>> maybe)
Conventional monad join operator.
|
static <T> Iterator<T> |
justs(Iterable<Optional<T>> maybes)
Filters nothings out of an Iterable of Optional T, returning an
Iterator of T.
|
static <T> Iterator<T> |
justs(Iterator<Optional<T>> maybes)
Filters nothings out of an Iterator of Optional T, returning an
Iterator of T.
|
static <T> Iterator<T> |
justs(Optional<T> first,
Optional<T> second)
Filters nothings out of an array of Optional T, returning an Iterator
of T.
|
static <T> Iterator<T> |
justs(Optional<T> first,
Optional<T> second,
Optional<T> third)
Filters nothings out of an array of Optional T, returning an Iterator
of T.
|
static <T,R> Function<Optional<T>,Optional<R>> |
lift(Function<T,R> function)
Transforms a function to another working on maybe monadic values.
|
static <T> Optional<T> |
lift(T value)
Transforms a null get to Optional.empty, a non-null get to
Optional.of(get)
|
static <T> Iterator<Optional<T>> |
lifts(Iterable<T> iterable)
Creates an iterator transforming elements from the source iterable to
Optional.empty when the source element is null, to
Optional.of(sourceValue) otherwise.
|
static <T> Iterator<Optional<T>> |
lifts(Iterator<T> iterator)
Creates an iterator transforming elements from the source iterator to
Optional.empty when the source element is null, to
Optional.of(sourceValue) otherwise.
|
static <T> Iterator<Optional<T>> |
lifts(T first,
T second)
Creates an iterator transforming passed values to Optional.empty when
the source element is null, to Optional.of(sourceValue) otherwise.
|
static <T> Iterator<Optional<T>> |
lifts(T first,
T second,
T third)
Creates an iterator transforming passed values to Optional.empty when
the source element is null, to Optional.of(sourceValue) otherwise.
|
static <T> Optional<T> |
pure(T value)
Yields Optional.pure() of a value.
|
static <T> Iterator<Optional<T>> |
pures(Iterable<T> values)
Creates an iterator transforming values from the source iterable into
pure() Optional
|
static <T> Iterator<Optional<T>> |
pures(Iterator<T> values)
Creates an iterator transforming values from the source iterator into
pure() Optional
|
static <T> Iterator<Optional<T>> |
pures(T... values)
Creates an iterator yielding values pure() Optional
|
static <T> Iterator<Optional<T>> |
pures(T value)
Creates a singleton iterator yielding pure() Optional
|
static <T> Iterator<Optional<T>> |
pures(T first,
T second)
Creates an iterator yielding pure() Optional
|
static <T> Iterator<Optional<T>> |
pures(T first,
T second,
T third)
Creates an iterator yielding pure() Optional
|
static <T> Maybe<T> |
toMaybe(Optional<T> optional)
Convert an Optional to a Maybe.
|
public static <T> Maybe<T> toMaybe(Optional<T> optional)
T - the optional value typeoptional - the value to be convertedpublic static <T> Optional<T> pure(T value)
Maybes.pure(1) -> Optional.of(1)T - the get typevalue - the get to be transformedpublic static <T> Iterator<Optional<T>> pures(Iterator<T> values)
Maybes.pures([1,2,3]) -> [Just 1, Just 2, Just 3]T - the iterator element typevalues - the source iteratorpublic static <T> Iterator<Optional<T>> pures(Iterable<T> values)
Maybes.pures([1,2,3]) -> [Just 1, Just 2, Just 3]T - the iterable element typevalues - the source iterablepublic static <T> Iterator<Optional<T>> pures(T value)
Maybes.pures(1) -> [Just 1]T - the element typevalue - the source getpublic static <T> Iterator<Optional<T>> pures(T first, T second)
Maybes.pures(1, 2) -> [Just 1, Just 2]T - the elements typefirst - the first elementsecond - the second elementpublic static <T> Iterator<Optional<T>> pures(T first, T second, T third)
Maybes.pures(1, 2, 3) -> [Just 1, Just 2, Just 3]T - the elements typefirst - the first elementsecond - the second elementthird - the third elementpublic static <T> Iterator<Optional<T>> pures(T... values)
Maybes.pures(1, 2, 3, 4) -> [Just 1, Just 2, Just 3, Just 4]T - the array element typevalues - the source arraypublic static <T> Iterator<T> justs(Iterator<Optional<T>> maybes)
Maybes.justs([Just 1, Nothing, Just null]) -> [1, null]T - the Optional type parametermaybes - an iterator of Optionalpublic static <T> Iterator<T> justs(Iterable<Optional<T>> maybes)
Maybes.justs([Just 1, Nothing, Just null]) -> [1, null]T - the Optional type parametermaybes - an iterable of Optionalpublic static <T> Iterator<T> justs(Optional<T> first, Optional<T> second)
Maybes.justs([Nothing, Just null]) -> [null]T - the Optional type parameterfirst - the first elementsecond - the second elementpublic static <T> Iterator<T> justs(Optional<T> first, Optional<T> second, Optional<T> third)
Maybes.justs([Just 1, Nothing, Just null]) -> [1, null]T - the Optional type parameterfirst - the first elementsecond - the second elementthird - the third elementpublic static <T> Optional<T> lift(T value)
T - the get type parametervalue - the get to be liftedpublic static <T,R> Function<Optional<T>,Optional<R>> lift(Function<T,R> function)
T - the function parameter typeR - the function return typefunction - the function to be liftedpublic static <T> Iterator<Optional<T>> lifts(Iterator<T> iterator)
Maybes.lift([null, 1, 2]) -> [Nothing, Just 1, Just 2]T - the get type parameteriterator - the iterator to be liftedpublic static <T> Iterator<Optional<T>> lifts(Iterable<T> iterable)
Maybes.lift([null, 1, 2]) -> [Nothing, Just 1, Just 2]T - the get type parameteriterable - the iterable to be liftedpublic static <T> Iterator<Optional<T>> lifts(T first, T second)
Maybes.lift(null, 1) -> [Nothing, Just 1]T - the get typefirst - the first elementsecond - the second elementpublic static <T> Iterator<Optional<T>> lifts(T first, T second, T third)
Maybes.lift(null, 1, 3) -> [Nothing, Just 1, Just 3]T - the get typefirst - the first elementsecond - the second elementthird - the third elementpublic static <T> T drop(Optional<T> optional)
Maybes.drop(Just 1) -> 1
Maybes.drop(Nothing) -> nullT - the get type parameteroptional - the right to be droppedpublic static <T> Iterator<T> drops(Iterator<Optional<T>> iterator)
Maybes.drops([Just null, Nothing, Just 3]) -> [null, null, 3]T - the get type parameteriterator - the iterator to be droppedpublic static <T> Iterator<T> drops(Iterable<Optional<T>> iterable)
Maybes.drops([Just null, Nothing, Just 3]) -> [null, null, 3]T - the get type parameteriterable - the Iterable to be droppedpublic static <T> Iterator<T> drops(Optional<T> first, Optional<T> second)
Maybes.drops([Just null, Just 3]) -> [null, 3]T - the get type parameterfirst - the first maybesecond - the second maybepublic static <T> Iterator<T> drops(Optional<T> first, Optional<T> second, Optional<T> third)
Maybes.drops([Just null, Just 3]) -> [null, 3]T - the get type parameterfirst - the first maybesecond - the second maybethird - the third maybepublic static <T> Optional<T> join(Optional<Optional<T>> maybe)
T - the get type parametermaybe - the source monadCopyright © 2017. All rights reserved.