|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.collections.functors.ForClosure<T>
public class ForClosure<T>
Closure implementation that calls another closure n times, like a for loop.
Constructor Summary | |
---|---|
ForClosure(int count,
Closure<T> closure)
Constructor that performs no validation. |
Method Summary | ||
---|---|---|
void |
execute(T input)
Executes the closure count times. |
|
Closure<T> |
getClosure()
Gets the closure. |
|
int |
getCount()
Gets the count. |
|
static
|
getInstance(int count,
Closure<T> closure)
Factory method that performs validation. |
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<T> closure)
getInstance
if you want that.
count
- the number of times to execute the closureclosure
- the closure to execute, not nullMethod Detail |
---|
public static <T> Closure<T> getInstance(int count, Closure<T> closure)
NOPClosure
.
A count of one returns the specified closure.
count
- the number of times to execute the closureclosure
- the closure to execute, not null
for
closurepublic void execute(T input)
count
times.
execute
in interface Closure<T>
input
- the input objectpublic Closure<T> getClosure()
public int getCount()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |