- All Implemented Interfaces:
public class ForClosure<E> extends java.lang.Object implements Closure<E>Closure implementation that calls another closure n times, like a for loop.
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.
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description
execute(E input)Executes the closure
static <E> Closure<E>
forClosure(int count, Closure<? super E> closure)Factory method that performs validation.
Closure<? super E>
getClosure()Gets the closure.
getCount()Gets the count.
forClosureFactory method that performs validation.
A null closure or zero count returns the
NOPClosure. A count of one returns the specified closure.
- Type Parameters:
E- the type that the closure acts on
count- the number of times to execute the closure
closure- the closure to execute, not null
public void execute(E input)Executes the closure
public int getCount()Gets the count.
- the count