Filtering and Selection
Gatherers that select or remove elements based on some criteria.
Gatherers
| Function | Description |
|---|---|
| debounce() | Limit the number of elements in the stream to some number per period, dropping anything over the limit during the period. |
| dedupeConsecutive() | Remove consecutive duplicate elements from a stream where equality is measured by Object::equals() |
| dedupeConsecutiveBy() | Remove consecutive duplicates, where equality is measured by a given function |
| distinctBy() | Filter a stream such that it only contains distinct elements measured by the given mappingFunction. |
| dropEveryNth() | Drop every nth element of the stream. |
| dropLast() | Keep all elements except the last count elements of the stream. |
| filterIndexed() | Filter a stream according to a given predicate, which takes both the item being examined and its index. |
| filterInstanceOf() | Filter the elements in the stream to only include elements of the given types. |
| filterOrdered() | Filter the input stream so that it contains Comparable<INPUT> elements in the order provided. |
| filterOrderedBy() | Filter the input stream so that it contains elements the order specified as measured by the given Comparator. |
| sampleFixedSize() | Perform a fixed size sampling over the input stream. |
| samplePercentage() | Perform a percentage-based sampling over the input stream. |
| takeEveryNth() | Take every nth element of the stream. |
| takeLast() | Remove all but the last count elements from the stream |
| takeUntil() | Take elements from the input stream until the predicate is met, including the first element that matches the predicate. |
| uniquelyOccurring() | Emit only those elements that occur in the input stream a single time. |