|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.commons.collections.functors.WhileClosure
Closure implementation that executes a closure repeatedly until a condition is met, like a do-while or while loop.
Constructor Summary | |
WhileClosure(Predicate predicate,
Closure closure,
boolean doLoop)
Constructor that performs no validation. |
Method Summary | |
void |
execute(Object input)
Execute the closure until the predicate is false. |
static Closure |
getInstance(Predicate predicate,
Closure closure,
boolean doLoop)
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 WhileClosure(Predicate predicate, Closure closure, boolean doLoop)
getInstance
if you want that.
predicate
- the predicate used to evaluate when the loop terminates, not nullclosure
- the closure the execute, not nulldoLoop
- true to act as a do-while loop, always executing the closure onceMethod Detail |
public static Closure getInstance(Predicate predicate, Closure closure, boolean doLoop)
predicate
- the predicate used to evaluate when the loop terminates, not nullclosure
- the closure the execute, not nulldoLoop
- true to act as a do-while loop, always executing the closure once
while
closure
IllegalArgumentException
- if the predicate or closure is nullpublic void execute(Object input)
execute
in interface Closure
input
- the input to execute on
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |