T
- Type of this Filterablepublic interface Filterable<T>
Modifier and Type | Method and Description |
---|---|
Filterable<T> |
filter(java.util.function.Predicate<? super T> predicate)
Keep only elements for which the supplied predicates hold
e.g.
|
default Filterable<T> |
filterNot(java.util.function.Predicate<? super T> predicate)
Remove any elements for which the predicate holds (inverse operation to filter)
e.g.
|
default Filterable<T> |
notNull()
Filter elements retaining only values which are not null
|
default <U> Filterable<U> |
ofType(java.lang.Class<? extends U> type)
Keep only those elements in a stream that are of a given type.
|
Filterable<T> filter(java.util.function.Predicate<? super T> predicate)
of(1,2,3).filter(i->i>2);
//[3]
predicate
- to filter elements by, retaining matchesdefault <U> Filterable<U> ofType(java.lang.Class<? extends U> type)
// (1, 2, 3) ReactiveSeq.of(1, "a", 2, "b",3).ofType(Integer.class)
default Filterable<T> filterNot(java.util.function.Predicate<? super T> predicate)
of(1,2,3).filter(i->i>2);
//[1,2]
predicate
- to filter elements by, retaining matchesdefault Filterable<T> notNull()
of(1,2,null,4).nonNull();
//[1,2,4]