Kactoos

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

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.

Parameters

X - Type of item

fnc - Predicate

src - Source

Since 0.1

Constructors

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>