public class ForClosure<E> extends Objectimplements Closure <E>
WARNING: from v4.1 onwards this class will not be serializable anymore in order to prevent potential remote code execution exploits. Please refer to COLLECTIONS-580 for more details.
| Constructor and Description |
|---|
ForClosure(int count, Closure
Constructor that performs no validation.
|
| Modifier and Type | Method and Description |
|---|---|
void |
execute(E input)
Executes the closure
count times.
|
static <E> Closure |
forClosure(int count, Closure
Factory method that performs validation.
|
Closure |
getClosure()
Gets the closure.
|
int |
getCount()
Gets the count.
|
public static <E> Closure<E> forClosure(int count, Closure <? super E> closure)
A null closure or zero count returns the NOPClosure. A count of one returns the specified closure.
E - the type that the closure acts on
count - the number of times to execute the closure
closure - the closure to execute, not null
for closure
public void execute(E input)
count times.
public int getCount()