kactoos-jvm / nnl.rocks.kactoos.scalar / AndWithIndexFunc / <init>
AndWithIndexFunc(proc: Proc<X>, vararg src: X)
proc - Proc to map
src - The iterable
X - Type of items in the iterableAndWithIndexFunc(func: BiFunc<X, Int, Boolean>, vararg src: X)
func - Func to map
src - The iterable
X - Type of items in the iterableAndWithIndexFunc(proc: BiProc<X, Int>, src: Iterable<X>)
src - The iterable
proc - Proc to use
X - Type of items in the iterable
Since 0.24
AndWithIndexFunc(func: BiFunc<X, Int, Boolean>, src: Iterable<X>)
src - The iterable
func - Func to map
X - Type of items in the iterable
Since 0.24
AndWithIndexFunc(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.
iterable - The iterable.
X - Generic type.
Since 0.20