|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.collections4.functors.ForClosure<E>
public class ForClosure<E>
Closure implementation that calls another closure n times, like a for loop.
Constructor Summary | |
---|---|
ForClosure(int count,
Closure<? super E> closure)
Constructor that performs no validation. |
Method Summary | ||
---|---|---|
void |
execute(E input)
Executes the closure count times. |
|
static
|
forClosure(int count,
Closure<? super E> closure)
Factory method that performs validation. |
|
Closure<? super E> |
getClosure()
Gets the closure. |
|
int |
getCount()
Gets the count. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ForClosure(int count, Closure<? super E> closure)
forClosure
if you want that.
count
- the number of times to execute the closureclosure
- the closure to execute, not nullMethod Detail |
---|
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 oncount
- the number of times to execute the closureclosure
- the closure to execute, not null
for
closurepublic void execute(E input)
count
times.
execute
in interface Closure<E>
input
- the input objectpublic Closure<? super E> getClosure()
public int getCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |