Modifier and Type | Field and Description |
---|---|
protected java.util.function.Function<I,java.lang.Boolean> |
condition
The function to be applied before each round on the loop to check whether the loop shall continue or break.
|
protected java.util.function.Function<I,I> |
reducer
A function to be applied after each round on the loop.
|
protected I |
variable
The variable first initialized.
|
Constructor and Description |
---|
For(I variable,
java.util.function.Function<I,java.lang.Boolean> condition,
java.util.function.Function<I,I> reducer)
Construct a new for loop with the given arguments.
|
For(I variable,
java.util.function.Function<I,java.lang.Boolean> condition,
java.util.function.Function<I,I> reducer,
java.util.function.BiConsumer<For<I>,I> code)
Construct a new for loop with the given arguments.
|
Modifier and Type | Method and Description |
---|---|
For<I> |
append(java.util.function.BiConsumer<For<I>,I> code)
Append the given code to the end of the looping code of this.
|
protected void |
loop()
The looping cod.
|
protected final java.util.function.Function<I,java.lang.Boolean> condition
protected final java.util.function.Function<I,I> reducer
variable
.protected I variable
public For(I variable, java.util.function.Function<I,java.lang.Boolean> condition, java.util.function.Function<I,I> reducer)
variable
- initial variablecondition
- looping conditionreducer
- action to be applied to the variable on each roundjava.lang.NullPointerException
- if ether the given 'condition' or 'reducer' is nullpublic For(I variable, java.util.function.Function<I,java.lang.Boolean> condition, java.util.function.Function<I,I> reducer, java.util.function.BiConsumer<For<I>,I> code)
variable
- initial variablecondition
- looping conditionreducer
- action to be applied to the variable on each roundcode
- first looping codejava.lang.NullPointerException
- if one of the given 'condition' or 'reducer' or 'code' is null