V
- public interface A<V> extends Iterable<V>, Mappable<V>, Filterable<V>, Appendable<V>, Prependable<V>, Serializable
Modifier and Type | Method and Description |
---|---|
Optional<V> |
asOptional() |
Optional<V> |
filter(Predicate<? super V> filter)
Provide a predicate that evaluates which element(s) to be
included.
|
V |
get() |
<O> Optional<O> |
map(Fn<? super V,O> mapper)
Map the contained to another value.
|
<O> Optional<O> |
map(Predicate<? super O> isPresent,
Fn<? super V,O> mapper)
Map the value to another value.
|
<O> Elements<O> |
split(Fn<? super V,? extends Iterable<O>> splitter)
Split the value into multiple values.
|
append, append
prepend, prepend
forEach, iterator, spliterator
V get()
Optional
, calling
get()
on A<V>
will never
throw an exception.<O> Optional<O> map(Fn<? super V,O> mapper)
Optional
of
the other type, which is "present" for any non-null value yielded from the
mapping.<O> Optional<O> map(Predicate<? super O> isPresent, Fn<? super V,O> mapper)
Optional
of
the other type. The given Predicate
decides if the resulting value
is "present".map(Fn)
Optional<V> filter(Predicate<? super V> filter)
Filterable
filter
in interface Filterable<V>
filter
- The predicate, when evaluates an element to false,
will exclude that element.<O> Elements<O> split(Fn<? super V,? extends Iterable<O>> splitter)
Due to limitations of the type system in Java, it is not possible to overload this
method to accept both functions yielding an Iterable
(as this method does)
as well as functions yielding an array. It is recommended to prefer implementing
functions
yielding Iterables. If implementing an array-yielding
function is most appropriate for your case, and you wish to use the function to split
an optional value using this method, it is possible to adapt the function using
Iterate.toIterable(Fn)
splitter
- a function yielding an iterable.Copyright © 2016. All Rights Reserved.