kactoos-jvm / nnl.rocks.kactoos.iterator / Filtered
class Filtered<out X : Any> : Iterator<X>
Filtered iterator.
You can use it in order to create a declarative/lazy version of a filtered collection/iterable. For example, this code will create a list of two strings “red” and “fox”:
val filtered = Filtered(
{ input -> input.length < 4 },
IteratorOf("red", "lazy", "fox")
)
There is no thread-safety guarantee.
X - Type of item
Since 0.1
| Name | Summary |
|---|---|
| <init> | Filtered(predicate: KFunc<X, Boolean>, iterator: Iterator<X>)Filtered(predicate: Func<X, Boolean>, iterator: Iterator<X>) |
| Name | Summary |
|---|---|
| hasNext | fun hasNext(): Boolean |
| next | fun next(): X |