public class ListUtils extends Object
Utility class for list processing.
Modifier and Type | Method and Description |
---|---|
static <T> void |
apply(List<T> list,
IAlgorithm<T> algorithm,
int startIndex)
Apply algorithm for each list element starting from specified position.
|
static <T> List<T> |
filter(List<T> list,
ICondition<T> cond)
Filter list elements by specified condition.
|
static <T> T |
find(List<T> list,
ICondition<T> cond,
Class clazz)
Find first occurrence of an list element which satisfy specified condition.
|
public static <T> void apply(List<T> list, IAlgorithm<T> algorithm, int startIndex)
Apply algorithm for each list element starting from specified position.
list
- List to process.algorithm
- Applied algorithm.startIndex
- Start element position.public static <T> List<T> filter(List<T> list, ICondition<T> cond)
Filter list elements by specified condition.
list
- A list to process.cond
- Condition used to filter the specified list.public static <T> T find(List<T> list, ICondition<T> cond, Class clazz)
Find first occurrence of an list element which satisfy specified condition.
T
- The type of object to find.list
- A list to process.cond
- Condition used to find an element in the specified list.clazz
- Class type of element T.