kactoos-jvm / nnl.rocks.kactoos.scalar / AndWithIndex
class AndWithIndex : 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
Since 0.4
| Name | Summary |
|---|---|
| <init> | AndWithIndex(vararg src: Func<Int, Boolean>)AndWithIndex(iterable: Iterable<Func<Int, Boolean>>)Logical conjunction, with index. |
| Name | Summary |
|---|---|
| invoke | fun invoke(): BooleanGet value of this Scalar |
| Name | Summary |
|---|---|
| invoke | operator fun <X : Any> invoke(proc: Proc<X>, vararg src: X): AndWithIndexoperator fun <X : Any> invoke(func: BiFunc<X, Int, Boolean>, vararg src: X): AndWithIndexoperator fun <X : Any> invoke(proc: BiProc<X, Int>, src: Iterable<X>): AndWithIndexoperator fun <X : Any> invoke(func: BiFunc<X, Int, Boolean>, src: Iterable<X>): AndWithIndex |