public class CollectionUtils
extends java.lang.Object
Constructor and Description |
---|
CollectionUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> T |
find(java.util.Collection<T> sourceList,
SimplePredicate predicate)
To find the first object in a collection that fulfills the condition
evaluated by the given predicate
|
static <T> java.util.List<T> |
findAll(java.util.Collection<T> sourceList,
SimplePredicate predicate)
To find all objects in a collection that fulfill the condition evaluated by
the given predicate
|
static <T> int |
indexOf(java.util.Collection<T> sourceList,
SimplePredicate predicate)
Returns the position in the array where the desired element has been found
or -1 if not found
|
static <T> int |
indexOf(T wanted,
java.util.Collection<T> sourceList)
To obtain the position of an element in a collection.
|
static <T> int |
indexOf(T wanted,
java.util.Collection<T> sourceList,
MatcherPredicate predicate)
Returns the position in the collection where the desired element has been
found or -1 if not found.
|
public static <T> int indexOf(T wanted, java.util.Collection<T> sourceList, MatcherPredicate predicate)
predicate
- A delegate object responsible to evaluate if the wanted object matches the target object in the collectionpublic static <T> int indexOf(T wanted, java.util.Collection<T> sourceList)
public static <T> int indexOf(java.util.Collection<T> sourceList, SimplePredicate predicate)
public static <T> T find(java.util.Collection<T> sourceList, SimplePredicate predicate)
public static <T> java.util.List<T> findAll(java.util.Collection<T> sourceList, SimplePredicate predicate)