public final class AndWithIndex extends Object implements Scalar<Boolean>
This class can be effectively used to iterate through
a collection, just like
Stream.forEach(java.util.function.Consumer)
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.
Scalar.NoNulls<T>
Constructor and Description |
---|
AndWithIndex(BiFunc<X,Integer,Boolean> func,
X... src)
Ctor.
|
AndWithIndex(Func<Integer,Boolean>... src)
Ctor.
|
AndWithIndex(Iterable<Func<Integer,Boolean>> src)
Ctor.
|
AndWithIndex(Iterable<X> src,
BiFunc<X,Integer,Boolean> func)
Ctor.
|
AndWithIndex(Iterable<X> src,
BiProc<X,Integer> proc)
Ctor.
|
AndWithIndex(Proc<X> proc,
X... src)
Ctor.
|
@SafeVarargs public AndWithIndex(Proc<X> proc, X... src)
X
- Type of items in the iterableproc
- Proc to mapsrc
- The iterable@SafeVarargs public AndWithIndex(BiFunc<X,Integer,Boolean> func, X... src)
X
- Type of items in the iterablefunc
- Func to mapsrc
- The iterablepublic AndWithIndex(Iterable<X> src, BiProc<X,Integer> proc)
X
- Type of items in the iterablesrc
- The iterableproc
- Proc to usepublic AndWithIndex(Iterable<X> src, BiFunc<X,Integer,Boolean> func)
X
- Type of items in the iterablesrc
- The iterablefunc
- Func to map@SafeVarargs public AndWithIndex(Func<Integer,Boolean>... src)
src
- The iterableCopyright © 2017 Cactoos. All rights reserved.