kactoos-jvm / nnl.rocks.kactoos.iterable / Filtered


class Filtered<out X : Any> : IterableEnvelope<X>

Filtered iterable.

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 },
    IterableOf("red", "lazy", "fox")

There is no thread-safety guarantee.


X - Type of item

fnc - Predicate

src - Source

Since 0.1


Name Summary
<init> Filtered(fnc: KFunc<X, Boolean>, vararg src: X)
Filtered(fnc: Func<X, Boolean>, src: Iterable<X>)Filtered(fnc: KFunc<X, Boolean>, src: Iterable<X>)
Filtered iterable.

Inherited Functions

Name Summary
iterator open fun iterator(): Iterator<T>