/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
public Object makeObject() { return new ForClosure(10, NOPClosure.INSTANCE); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }
/** * Creates a Closure that will call the closure <code>count</code> times. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * * @see org.apache.commons.collections.functors.ForClosure * * @param count the number of times to loop * @param closure the closure to call repeatedly * @return the <code>for</code> closure */ public static Closure forClosure(int count, Closure closure) { return ForClosure.getInstance(count, closure); }
/** * Factory method that performs validation. * <p> * A null closure or zero count returns the <code>NOPClosure</code>. * A count of one returns the specified closure. * * @param count the number of times to execute the closure * @param closure the closure to execute, not null * @return the <code>for</code> closure */ public static Closure getInstance(int count, Closure closure) { if (count <= 0 || closure == null) { return NOPClosure.INSTANCE; } if (count == 1) { return closure; } return new ForClosure(count, closure); }