| Package | Description |
|---|---|
| com.annimon.stream |
| Modifier and Type | Method and Description |
|---|---|
static <T> Optional<T> |
Optional.empty()
Returns an empty
Optional. |
Optional<T> |
Optional.executeIfAbsent(Runnable action)
Invokes action function if value is absent.
|
Optional<T> |
Optional.executeIfPresent(Consumer<? super T> consumer)
Invokes consumer function with the value if present.
|
Optional<T> |
Optional.filter(Predicate<? super T> predicate)
Performs filtering on inner value if present.
|
Optional<T> |
Stream.findFirst()
Returns the first element wrapped by
Optional class. |
Optional<T> |
Stream.findSingle()
Returns the single element wrapped by
Optional class. |
<U> Optional<U> |
Optional.flatMap(Function<? super T,Optional<U>> mapper)
Invokes mapping function with
Optional result if value is present. |
Optional<T> |
Exceptional.getOptional()
Wraps inner value with
Optional container |
<U> Optional<U> |
Optional.map(Function<? super T,? extends U> mapper)
Invokes the given mapping function on inner value if present.
|
<U> Optional<U> |
OptionalDouble.mapToObj(DoubleFunction<U> mapper)
Invokes the given mapping function on inner value if present.
|
<U> Optional<U> |
OptionalInt.mapToObj(IntFunction<U> mapper)
Invokes mapping function on inner value if present.
|
<U> Optional<U> |
OptionalLong.mapToObj(LongFunction<U> mapper)
Invokes the given mapping function on inner value if present.
|
Optional<T> |
Stream.max(Comparator<? super T> comparator)
Finds the maximum element according to the given comparator.
|
Optional<T> |
Stream.min(Comparator<? super T> comparator)
Finds the minimum element according to the given comparator.
|
static <T> Optional<T> |
Optional.of(T value)
Returns an
Optional with the specified present non-null value. |
static <T> Optional<T> |
Optional.ofNullable(T value)
Returns an
Optional with the specified value, or empty Optional if value is null. |
Optional<T> |
Optional.or(Supplier<Optional<T>> supplier)
Returns current
Optional if value is present, otherwise
returns an Optional produced by supplier function. |
Optional<T> |
Stream.reduce(BiFunction<T,T,T> accumulator)
Reduces the elements using provided associative accumulation function.
|
<R> Optional<R> |
Optional.select(Class<R> clazz)
Keeps inner value only if is present and instance of given class.
|
| Modifier and Type | Method and Description |
|---|---|
<U> Optional<U> |
Optional.flatMap(Function<? super T,Optional<U>> mapper)
Invokes mapping function with
Optional result if value is present. |
Optional<T> |
Optional.or(Supplier<Optional<T>> supplier)
Returns current
Optional if value is present, otherwise
returns an Optional produced by supplier function. |
Copyright © 2017. All rights reserved.