Esempio n. 1
0
 /**
  * Creates a Closure that will call the closure once and then repeatedly
  * until the predicate returns false.
  *
  * @see org.apache.commons.collections.functors.WhileClosure
  *
  * @param closure  the closure to call repeatedly, not null
  * @param predicate  the predicate to use as an end of loop test, not null
  * @return the <code>do-while</code> closure
  * @throws IllegalArgumentException if either argument is null
  */
 public static Closure doWhileClosure(Closure closure, Predicate predicate)
 {
     return(WhileClosure.getInstance(predicate, closure, true));
 }
Esempio n. 2
0
 /**
  * Creates a Closure that will call the closure repeatedly until the
  * predicate returns false.
  *
  * @see org.apache.commons.collections.functors.WhileClosure
  *
  * @param predicate  the predicate to use as an end of loop test, not null
  * @param closure  the closure to call repeatedly, not null
  * @return the <code>while</code> closure
  * @throws IllegalArgumentException if either argument is null
  */
 public static Closure whileClosure(Predicate predicate, Closure closure)
 {
     return(WhileClosure.getInstance(predicate, closure, false));
 }