T
- Data type of the element(s) in this FilterableFunctorpublic interface FilterableFunctor<T> extends Filterable<T>, Functor<T>
Modifier and Type | Method and Description |
---|---|
FilterableFunctor<T> |
filter(java.util.function.Predicate<? super T> fn)
Keep only elements for which the supplied predicates hold
e.g.
|
<R> FilterableFunctor<R> |
map(java.util.function.Function<? super T,? extends R> fn)
Transform this functor using the supplied transformation function
|
filterNot, notNull, ofType
cast, patternMatch, peek, trampoline
FilterableFunctor<T> filter(java.util.function.Predicate<? super T> fn)
Filterable
of(1,2,3).filter(i->i>2);
//[3]
filter
in interface Filterable<T>
fn
- to filter elements by, retaining matches<R> FilterableFunctor<R> map(java.util.function.Function<? super T,? extends R> fn)
Functor
of(1,2,3).map(i->i*2)
//[2,4,6]