kactoos-jvm / nnl.rocks.kactoos.scalar / AndWithIndexFunc
class AndWithIndexFunc<X : Any> : Scalar<Boolean>
Logical conjunction, with index.
This class can be effectively used to iterate through a collection, just like java.util.stream.Stream.forEach works, but with an index provided for each item:
new And(
new IterableOf("Mary", "John", "William", "Napkin"),
new BiFuncOf<>(
(text, index) -> System.out.printf("Name #%d: %s\n", index, text),
true
)
).value();
There is no thread-safety guarantee.
iterable - The iterable.
X - Generic type.
Since 0.20
| Name | Summary |
|---|---|
| <init> | AndWithIndexFunc(proc: Proc<X>, vararg src: X)AndWithIndexFunc(func: BiFunc<X, Int, Boolean>, vararg src: X)AndWithIndexFunc(proc: BiProc<X, Int>, src: Iterable<X>)AndWithIndexFunc(func: BiFunc<X, Int, Boolean>, src: Iterable<X>)AndWithIndexFunc(iterable: Iterable<Func<Int, Boolean>>)Logical conjunction, with index. |
| Name | Summary |
|---|---|
| invoke | fun invoke(): BooleanGet value of this Scalar |