Uses of Interface
org.apache.commons.collections4.Closure
-
Packages that use Closure Package Description org.apache.commons.collections4 This package contains the interfaces and utilities shared across all the subpackages of this component.org.apache.commons.collections4.functors This package contains implementations of theClosure,Predicate,TransformerandFactoryinterfaces. -
-
Uses of Closure in org.apache.commons.collections4
Methods in org.apache.commons.collections4 with type parameters of type Closure Modifier and Type Method Description static <T,C extends Closure<? super T>>
TCollectionUtils. forAllButLastDo(java.lang.Iterable<T> collection, C closure)Deprecated.since 4.1, useIterableUtils.forEachButLast(Iterable, Closure)insteadstatic <T,C extends Closure<? super T>>
TCollectionUtils. forAllButLastDo(java.util.Iterator<T> iterator, C closure)Deprecated.since 4.1, useIteratorUtils.forEachButLast(Iterator, Closure)insteadstatic <T,C extends Closure<? super T>>
CCollectionUtils. forAllDo(java.lang.Iterable<T> collection, C closure)Deprecated.since 4.1, useIterableUtils.forEach(Iterable, Closure)insteadstatic <T,C extends Closure<? super T>>
CCollectionUtils. forAllDo(java.util.Iterator<T> iterator, C closure)Deprecated.since 4.1, useIteratorUtils.forEach(Iterator, Closure)insteadMethods in org.apache.commons.collections4 that return Closure Modifier and Type Method Description static <E> Closure<E>ClosureUtils. asClosure(Transformer<? super E,?> transformer)Creates a Closure that calls a Transformer each time it is called.static <E> Closure<E>ClosureUtils. chainedClosure(java.util.Collection<? extends Closure<? super E>> closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>ClosureUtils. chainedClosure(Closure<? super E>... closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>ClosureUtils. doWhileClosure(Closure<? super E> closure, Predicate<? super E> predicate)Creates a Closure that will call the closure once and then repeatedly until the predicate returns false.static <E> Closure<E>ClosureUtils. exceptionClosure()Gets a Closure that always throws an exception.static <E> Closure<E>ClosureUtils. forClosure(int count, Closure<? super E> closure)Creates a Closure that will call the closurecounttimes.static <E> Closure<E>ClosureUtils. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure)Create a new Closure that calls another closure based on the result of the specified predicate.static <E> Closure<E>ClosureUtils. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure)Create a new Closure that calls one of two closures depending on the specified predicate.static <E> Closure<E>ClosureUtils. invokerClosure(java.lang.String methodName)Creates a Closure that will invoke a specific method on the closure's input object by reflection.static <E> Closure<E>ClosureUtils. invokerClosure(java.lang.String methodName, java.lang.Class<?>[] paramTypes, java.lang.Object[] args)Creates a Closure that will invoke a specific method on the closure's input object by reflection.static <E> Closure<E>ClosureUtils. nopClosure()Gets a Closure that will do nothing.static <E> Closure<E>ClosureUtils. switchClosure(java.util.Map<Predicate<E>,Closure<E>> predicatesAndClosures)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. switchMapClosure(java.util.Map<? extends E,Closure<E>> objectsAndClosures)Create a new Closure that uses the input object as a key to find the closure to call.static <E> Closure<E>ClosureUtils. whileClosure(Predicate<? super E> predicate, Closure<? super E> closure)Creates a Closure that will call the closure repeatedly until the predicate returns false.Methods in org.apache.commons.collections4 with parameters of type Closure Modifier and Type Method Description static <T> Transformer<T,T>TransformerUtils. asTransformer(Closure<? super T> closure)Creates a Transformer that calls a Closure each time the transformer is used.static <E> Closure<E>ClosureUtils. chainedClosure(Closure<? super E>... closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>ClosureUtils. doWhileClosure(Closure<? super E> closure, Predicate<? super E> predicate)Creates a Closure that will call the closure once and then repeatedly until the predicate returns false.static <E> Closure<E>ClosureUtils. forClosure(int count, Closure<? super E> closure)Creates a Closure that will call the closurecounttimes.voidFluentIterable. forEach(Closure<? super E> closure)Applies the closure to all elements contained in this iterable.static <E> voidIterableUtils. forEach(java.lang.Iterable<E> iterable, Closure<? super E> closure)Applies the closure to each element of the provided iterable.static <E> voidIteratorUtils. forEach(java.util.Iterator<E> iterator, Closure<? super E> closure)Applies the closure to each element of the provided iterator.static <E> EIterableUtils. forEachButLast(java.lang.Iterable<E> iterable, Closure<? super E> closure)Executes the given closure on each but the last element in the iterable.static <E> EIteratorUtils. forEachButLast(java.util.Iterator<E> iterator, Closure<? super E> closure)Executes the given closure on each but the last element in the iterator.static <E> Closure<E>ClosureUtils. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure)Create a new Closure that calls another closure based on the result of the specified predicate.static <E> Closure<E>ClosureUtils. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure)Create a new Closure that calls one of two closures depending on the specified predicate.static <E> Closure<E>ClosureUtils. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. whileClosure(Predicate<? super E> predicate, Closure<? super E> closure)Creates a Closure that will call the closure repeatedly until the predicate returns false.Method parameters in org.apache.commons.collections4 with type arguments of type Closure Modifier and Type Method Description static <E> Closure<E>ClosureUtils. chainedClosure(java.util.Collection<? extends Closure<? super E>> closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>ClosureUtils. switchClosure(java.util.Map<Predicate<E>,Closure<E>> predicatesAndClosures)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>ClosureUtils. switchMapClosure(java.util.Map<? extends E,Closure<E>> objectsAndClosures)Create a new Closure that uses the input object as a key to find the closure to call. -
Uses of Closure in org.apache.commons.collections4.functors
Classes in org.apache.commons.collections4.functors that implement Closure Modifier and Type Class Description classCatchAndRethrowClosure<E>Closurethat catches any checked exception and re-throws it as aFunctorExceptionruntime exception.classChainedClosure<E>Closure implementation that chains the specified closures together.classExceptionClosure<E>Closure implementation that always throws an exception.classForClosure<E>Closure implementation that calls another closure n times, like a for loop.classIfClosure<E>Closure implementation acts as an if statement calling one or other closure based on a predicate.classNOPClosure<E>Closure implementation that does nothing.classSwitchClosure<E>Closure implementation calls the closure whose predicate returns true, like a switch statement.classTransformerClosure<E>Closure implementation that calls a Transformer using the input object and ignore the result.classWhileClosure<E>Closure implementation that executes a closure repeatedly until a condition is met, like a do-while or while loop.Fields in org.apache.commons.collections4.functors declared as Closure Modifier and Type Field Description private Closure<? super T>ClosureTransformer. iClosureThe closure to wrapprivate Closure<? super E>ForClosure. iClosureThe closure to callprivate Closure<? super E>WhileClosure. iClosureThe closure to callprivate Closure<? super E>[]ChainedClosure. iClosuresThe closures to call in turnprivate Closure<? super E>[]SwitchClosure. iClosuresThe matching closures to callprivate Closure<? super E>SwitchClosure. iDefaultThe default closure to call if no tests matchprivate Closure<? super E>IfClosure. iFalseClosureThe closure to use if falsestatic ClosureExceptionClosure. INSTANCESingleton predicate instancestatic ClosureNOPClosure. INSTANCESingleton predicate instanceprivate Closure<? super E>IfClosure. iTrueClosureThe closure to use if trueMethods in org.apache.commons.collections4.functors that return Closure Modifier and Type Method Description static <E> Closure<E>ChainedClosure. chainedClosure(java.util.Collection<? extends Closure<? super E>> closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>ChainedClosure. chainedClosure(Closure<? super E>... closures)Factory method that performs validation and copies the parameter array.(package private) static <T> Closure<T>FunctorUtils. coerce(Closure<? super T> closure)A very simple method that coerces Closure super T> to Closure. (package private) static <E> Closure<E>[]FunctorUtils. copy(Closure<? super E>... closures)Clone the closures to ensure that the internal reference can't be messed with.static <E> Closure<E>ExceptionClosure. exceptionClosure()Factory returning the singleton instance.static <E> Closure<E>ForClosure. forClosure(int count, Closure<? super E> closure)Factory method that performs validation.Closure<? super T>ClosureTransformer. getClosure()Gets the closure.Closure<? super E>ForClosure. getClosure()Gets the closure.Closure<? super E>WhileClosure. getClosure()Gets the closure.Closure<? super E>[]ChainedClosure. getClosures()Gets the closures.Closure<? super E>[]SwitchClosure. getClosures()Gets the closures.Closure<? super E>SwitchClosure. getDefaultClosure()Gets the default closure.Closure<? super E>IfClosure. getFalseClosure()Gets the closure called when false.Closure<? super E>IfClosure. getTrueClosure()Gets the closure called when true.static <E> Closure<E>IfClosure. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure)Factory method that performs validation.static <E> Closure<E>IfClosure. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure)Factory method that performs validation.static <E> Closure<E>NOPClosure. nopClosure()Factory returning the singleton instance.static <E> Closure<E>SwitchClosure. switchClosure(java.util.Map<Predicate<E>,Closure<E>> predicatesAndClosures)Create a new Closure that calls one of the closures depending on the predicates.static <E> Closure<E>SwitchClosure. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Factory method that performs validation and copies the parameter arrays.static <E> Closure<E>TransformerClosure. transformerClosure(Transformer<? super E,?> transformer)Factory method that performs validation.static <E> Closure<E>WhileClosure. whileClosure(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop)Factory method that performs validation.Methods in org.apache.commons.collections4.functors with parameters of type Closure Modifier and Type Method Description static <E> Closure<E>ChainedClosure. chainedClosure(Closure<? super E>... closures)Factory method that performs validation and copies the parameter array.static <T> Transformer<T,T>ClosureTransformer. closureTransformer(Closure<? super T> closure)Factory method that performs validation.(package private) static <T> Closure<T>FunctorUtils. coerce(Closure<? super T> closure)A very simple method that coerces Closure super T> to Closure. (package private) static <E> Closure<E>[]FunctorUtils. copy(Closure<? super E>... closures)Clone the closures to ensure that the internal reference can't be messed with.static <E> Closure<E>ForClosure. forClosure(int count, Closure<? super E> closure)Factory method that performs validation.static <E> Closure<E>IfClosure. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure)Factory method that performs validation.static <E> Closure<E>IfClosure. ifClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure)Factory method that performs validation.static <E> Closure<E>SwitchClosure. switchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Factory method that performs validation and copies the parameter arrays.(package private) static voidFunctorUtils. validate(Closure<?>... closures)Validate the closures to ensure that all is well.static <E> Closure<E>WhileClosure. whileClosure(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop)Factory method that performs validation.Method parameters in org.apache.commons.collections4.functors with type arguments of type Closure Modifier and Type Method Description static <E> Closure<E>ChainedClosure. chainedClosure(java.util.Collection<? extends Closure<? super E>> closures)Create a new Closure that calls each closure in turn, passing the result into the next closure.static <E> Closure<E>SwitchClosure. switchClosure(java.util.Map<Predicate<E>,Closure<E>> predicatesAndClosures)Create a new Closure that calls one of the closures depending on the predicates.Constructors in org.apache.commons.collections4.functors with parameters of type Closure Constructor Description ChainedClosure(boolean clone, Closure<? super E>... closures)Hidden constructor for the use by the static factory methods.ChainedClosure(Closure<? super E>... closures)Constructor that performs no validation.ClosureTransformer(Closure<? super T> closure)Constructor that performs no validation.ForClosure(int count, Closure<? super E> closure)Constructor that performs no validation.IfClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure)Constructor that performs no validation.IfClosure(Predicate<? super E> predicate, Closure<? super E> trueClosure, Closure<? super E> falseClosure)Constructor that performs no validation.SwitchClosure(boolean clone, Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Hidden constructor for the use by the static factory methods.SwitchClosure(Predicate<? super E>[] predicates, Closure<? super E>[] closures, Closure<? super E> defaultClosure)Constructor that performs no validation.WhileClosure(Predicate<? super E> predicate, Closure<? super E> closure, boolean doLoop)Constructor that performs no validation.
-