| Package | Description |
|---|---|
| io.atlassian.fugue |
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Option<B> |
Options.ap(Option<A> oa,
Option<Function<A,B>> of)
Applies an option of A to an option of a function with input type A and
result type B and return an option of B.
|
Option<A> |
Option.filter(Predicate<? super A> p)
Returns this
Option if it is nonempty
and applying the predicate to this option's value returns
true. |
<X> Option<Either<L,X>> |
Either.LeftProjection.filter(Predicate<? super L> f)
Returns
None if this projection has no value or if the given
predicate p does not hold for the value, otherwise, returns
a left in Some. |
Option<Either<L,R>> |
Either.filter(Predicate<? super R> p)
Returns
None if this is a left or if the given predicate
p does not hold for the contained value, otherwise, returns a
right in Some. |
<X> Option<Either<X,R>> |
Either.RightProjection.filter(Predicate<? super R> f)
Returns
None if this projection has no value or if the given
predicate p does not hold for the value, otherwise, returns
a right in Some. |
static <A> Option<A> |
Options.find(Iterable<Option<A>> options)
Find the first option that
isDefined, or if there aren't any, then none. |
static <T> Option<T> |
Iterables.findFirst(Iterable<? extends T> elements,
Predicate<? super T> p)
Finds the first item that matches the predicate.
|
static <A> Option<A> |
Iterables.first(Iterable<A> as)
If
as is empty, returns none(). |
<B> Option<B> |
Option.flatMap(Function<? super A,? extends Option<? extends B>> f)
Apply
f to the value if defined. |
static <A> Option<A> |
Option.fromOptional(Optional<A> optional)
|
<B> Option<B> |
Option.map(Function<? super A,? extends B> f)
Apply
f to the value if defined. |
static <A> Option<A> |
Option.none()
Factory method for None instances.
|
static <A> Option<A> |
Option.none(Class<A> type)
Factory method for None instances where the type token is handy.
|
static <A> Option<A> |
Option.option(A a)
Factory method for
Option instances. |
Option<A> |
Option.orElse(Option<? extends A> orElse)
If this is a some, return the same some.
|
Option<A> |
Option.orElse(Supplier<? extends Option<? extends A>> orElse)
If this is a some, return the same some.
|
static <A> Option<A> |
Option.some(A value)
Factory method for Some instances.
|
Option<R> |
Either.toOption()
Convert this Either to an Option.
|
Option<? super A> |
Either.Projection.toOption()
Returns this projection's value in
Some if it exists,
otherwise None. |
abstract Option<A> |
Try.toOption()
Convert this Try to an Option.
|
static <AA,A extends AA> |
Options.upcast(Option<A> o)
Upcasts an
option of type A to an option of its super type
AA. |
| Modifier and Type | Method and Description |
|---|---|
static <A,B,C> Function<A,Option<C>> |
Functions.composeOption(Function<? super B,? extends Option<? extends C>> bc,
Function<? super A,? extends Option<? extends B>> ab)
Compose two PartialFunctions into one.
|
static <A> Predicate<Option<A>> |
Option.defined()
Predicate for filtering defined options only.
|
static <A> Iterable<Option<A>> |
Options.filterNone(Iterable<Option<A>> options)
Filter out undefined options.
|
static <A> Function<Iterable<A>,Option<A>> |
Iterables.findFirst(Predicate<? super A> predicate)
Partial application of the predicate argument to
Iterables.findFirst(Iterable, Predicate) returning a function that takes an
Iterable as its argument |
static <A> Monoid<Option<A>> |
Monoids.firstOption()
A monoid for options (that take the first available value).
|
static <A> Collector<Option<A>,?,List<A>> |
FugueCollectors.flatten()
Collect the values wrapped within the option.
|
static <A,B,C> Collector<Option<A>,?,C> |
FugueCollectors.flatten(Collector<A,B,C> aCollector)
Collect the values wrapped within the option.
|
static <A,B> Function<A,Option<B>> |
Functions.forMap(Map<A,B> map)
Create a function that performs a map lookup returning None for null
If you do not need a nondefaulted return result using a method reference is
preferred map::get
|
static <A,B> Function<A,Option<B>> |
Functions.isInstanceOf(Class<B> cls)
Partial Function that does a type check and matches if the value is of the
right type.
|
static <A> Monoid<Option<A>> |
Monoids.lastOption()
A monoid for options that take the last available value.
|
static <L,R> Function<Either<L,R>,Option<L>> |
Eithers.leftMapper()
A function that maps an either to an option of its left type.
|
static <A,B> Function<Function<A,B>,Function<Option<A>,Option<B>>> |
Options.lift()
Returns a function that will lift a function that takes an A and returns a
B into a function that takes an option of A and returns an option of B.
|
static <A,B> Function<Function<A,B>,Function<Option<A>,Option<B>>> |
Options.lift()
Returns a function that will lift a function that takes an A and returns a
B into a function that takes an option of A and returns an option of B.
|
static <A,B> Function<Option<A>,Option<B>> |
Options.lift(Function<A,B> f)
Lifts a function that takes an A and returns a B into a function that takes
an option of A and returns an option of B.
|
static <A,B> Function<Option<A>,Option<B>> |
Options.lift(Function<A,B> f)
Lifts a function that takes an A and returns a B into a function that takes
an option of A and returns an option of B.
|
static <A> Predicate<Option<A>> |
Options.lift(Predicate<? super A> pred)
Lifts a predicate that takes an A into a predicate that takes an option of
A.
|
static <A,B,C> Function<BiFunction<A,B,C>,BiFunction<Option<A>,Option<B>,Option<C>>> |
Options.lift2()
Returns a function that will lift a function that takes an A and a B and
returns a C into a function that takes an option of A and an option of B
and returns an option of C.
|
static <A,B,C> Function<BiFunction<A,B,C>,BiFunction<Option<A>,Option<B>,Option<C>>> |
Options.lift2()
Returns a function that will lift a function that takes an A and a B and
returns a C into a function that takes an option of A and an option of B
and returns an option of C.
|
static <A,B,C> Function<BiFunction<A,B,C>,BiFunction<Option<A>,Option<B>,Option<C>>> |
Options.lift2()
Returns a function that will lift a function that takes an A and a B and
returns a C into a function that takes an option of A and an option of B
and returns an option of C.
|
static <A,B,C> BiFunction<Option<A>,Option<B>,Option<C>> |
Options.lift2(BiFunction<A,B,C> f2)
Lifts a function that takes an A and a B and returns a C into a function
that takes an option of A and an option of B and returns an option of C.
|
static <A,B,C> BiFunction<Option<A>,Option<B>,Option<C>> |
Options.lift2(BiFunction<A,B,C> f2)
Lifts a function that takes an A and a B and returns a C into a function
that takes an option of A and an option of B and returns an option of C.
|
static <A,B,C> BiFunction<Option<A>,Option<B>,Option<C>> |
Options.lift2(BiFunction<A,B,C> f2)
Lifts a function that takes an A and a B and returns a C into a function
that takes an option of A and an option of B and returns an option of C.
|
static <A,B> Function<A,Option<B>> |
Functions.mapNullToOption(Function<? super A,? extends B> f)
Maps a function that returns nulls into a Partial function that returns an
Option of the result.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A> Supplier<Option<A>> |
Option.noneSupplier()
Supplies None as required.
|
static <A,B> Function<A,Option<B>> |
Options.nullSafe(Function<A,B> nullProducing)
Turn a null producing function into one that returns an option instead.
|
static <A> Function<A,Option<A>> |
Functions.nullToOption()
Function that turns null inputs into a none, and not-null inputs into some.
|
static <A> Monoid<Option<A>> |
Monoids.option(Semigroup<A> semigroup)
A monoid for options that combine inner value with a semigroup.
|
static <A,B> Function<A,Option<B>> |
Functions.partial(Predicate<? super A> p,
Function<? super A,? extends B> f)
|
static <L,R> Function<Either<L,R>,Option<R>> |
Eithers.rightMapper()
A function that maps an either to an option of its right type.
|
static <A> Function<A,Option<A>> |
Options.toOption()
Function for wrapping values in a Some or None.
|
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Option<B> |
Options.ap(Option<A> oa,
Option<Function<A,B>> of)
Applies an option of A to an option of a function with input type A and
result type B and return an option of B.
|
static <A,B> Option<B> |
Options.ap(Option<A> oa,
Option<Function<A,B>> of)
Applies an option of A to an option of a function with input type A and
result type B and return an option of B.
|
static <A> Supplier<A> |
Suppliers.fromOption(Option<A> option)
Turns an Option into a supplier, but throws an exception if undefined.
|
Option<A> |
Option.orElse(Option<? extends A> orElse)
If this is a some, return the same some.
|
static <AA,A extends AA> |
Options.upcast(Option<A> o)
Upcasts an
option of type A to an option of its super type
AA. |
| Modifier and Type | Method and Description |
|---|---|
static <A,B> Iterable<B> |
Iterables.collect(Iterable<? extends A> from,
Function<? super A,Option<B>> partial)
Filters and maps (aka transforms) the unfiltered iterable.
|
static <A,B,C> Function<A,Option<C>> |
Functions.composeOption(Function<? super B,? extends Option<? extends C>> bc,
Function<? super A,? extends Option<? extends B>> ab)
Compose two PartialFunctions into one.
|
static <A,B,C> Function<A,Option<C>> |
Functions.composeOption(Function<? super B,? extends Option<? extends C>> bc,
Function<? super A,? extends Option<? extends B>> ab)
Compose two PartialFunctions into one.
|
static <A> Iterable<Option<A>> |
Options.filterNone(Iterable<Option<A>> options)
Filter out undefined options.
|
static <A> Option<A> |
Options.find(Iterable<Option<A>> options)
Find the first option that
isDefined, or if there aren't any, then none. |
<B> Option<B> |
Option.flatMap(Function<? super A,? extends Option<? extends B>> f)
Apply
f to the value if defined. |
static <A> Iterable<A> |
Options.flatten(Iterable<Option<A>> options)
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
static <A,B> Function<A,Option<B>> |
Functions.matches(Function<? super A,? extends Option<? extends B>> f1,
Function<? super A,? extends Option<? extends B>> f2,
Function<? super A,? extends Option<? extends B>> f3,
Function<? super A,? extends Option<? extends B>> f4,
Function<? super A,? extends Option<? extends B>> f5,
Function<? super A,? extends Option<? extends B>>... fs)
Creates a stack of matcher functions and returns the first result that
matches.
|
Option<A> |
Option.orElse(Supplier<? extends Option<? extends A>> orElse)
If this is a some, return the same some.
|
static <A,B> Iterable<A> |
Iterables.unfold(Function<? super B,Option<Pair<A,B>>> f,
B seed)
Builds an Iterable from a seed value until
f returns none()
. |
Copyright © 2018 Atlassian. All rights reserved.