Kactoos

kactoos-jvm / nnl.rocks.kactoos.scalar / AndWithIndex / <init>

<init>

AndWithIndex(vararg src: Func<Int, Boolean>)

Parameters

src - The iterableAndWithIndex(iterable: Iterable<Func<Int, 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.

Parameters

iterable - The iterable

Since 0.4