|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.springframework.rules.closure.support.Algorithms
public class Algorithms
Convenience utility class which provides a number of algorithms involving function objects such as closures and constraints.
Constructor Summary | |
---|---|
Algorithms()
|
Method Summary | |
---|---|
boolean |
allTrue(Collection collection,
Constraint constraint)
Returns true if all elements in the given collection meet the specified predicate condition. |
boolean |
allTrue(Iterator it,
Constraint constraint)
Returns true if all elements in the given collection meet the specified predicate condition. |
boolean |
anyTrue(Collection collection,
Constraint constraint)
Returns true if any elements in the given collection meet the specified predicate condition. |
boolean |
anyTrue(Iterator it,
Constraint constraint)
Returns true if any elements in the given collection meet the specified predicate condition. |
Collection |
findAll(Collection collection,
Constraint constraint)
Find all the elements in the collection that match the specified constraint. |
Collection |
findAll(Iterator it,
Constraint constraint)
Find all the elements in the collection that match the specified constraint. |
Object |
findFirst(Collection collection,
Constraint constraint)
Find the first element in the collection matching the specified constraint. |
Object |
findFirst(Iterator it,
Constraint constraint)
Find the first element in the collection matching the specified constraint. |
void |
forEach(Collection collection,
Closure closure)
Execute the provided closure for each element in the collection. |
void |
forEach(Iterator it,
Closure closure)
Execute the provided closure for each element in the collection. |
static Algorithms |
instance()
Singleton instance accessor |
static void |
load(Algorithms instance)
Load the shared instance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Algorithms()
Method Detail |
---|
public static void load(Algorithms instance)
instance
- public static Algorithms instance()
public boolean anyTrue(Collection collection, Constraint constraint)
collection
- the collectionconstraint
- the iterator
public boolean anyTrue(Iterator it, Constraint constraint)
it
- the iteratorconstraint
- the constraint
public boolean allTrue(Collection collection, Constraint constraint)
collection
- constraint
-
public boolean allTrue(Iterator it, Constraint constraint)
it
- the iteratorconstraint
- the constraint
public Object findFirst(Collection collection, Constraint constraint)
collection
- the collectionconstraint
- the predicate
public Object findFirst(Iterator it, Constraint constraint)
it
- the iteratorconstraint
- the predicate
public Collection findAll(Collection collection, Constraint constraint)
collection
- constraint
-
public Collection findAll(Iterator it, Constraint constraint)
it
- the iteratorconstraint
- the constraint
public void forEach(Collection collection, Closure closure)
collection
- the collectionclosure
- the callbackpublic void forEach(Iterator it, Closure closure)
it
- the iteratorclosure
- the callback
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |