ListUtils
Inheritance: java.lang.Object
public class ListUtils
Utility class for list processing.
Methods
Method | Description |
---|---|
<T>apply(List<T> list, IAlgorithm<T> algorithm, int startIndex) | Apply algorithm for each list element starting from specified position. |
<T>filter(List<T> list, ICondition<T> cond) | Filter list elements by specified condition. |
<T>find(List<T> list, ICondition<T> cond, Class clazz) | Find first occurrence of an list element which satisfy specified condition. |
<T>apply(List<T> list, IAlgorithm<T> algorithm, int startIndex)
public static void <T>apply(List<T> list, IAlgorithm<T> algorithm, int startIndex)
Apply algorithm for each list element starting from specified position.
Parameters:
Parameter | Type | Description |
---|---|---|
list | java.util.List<T> | List to process. |
algorithm | IAlgorithm | Applied algorithm. |
startIndex | int | Start element position. |
<T>filter(List<T> list, ICondition<T> cond)
public static List<T> <T>filter(List<T> list, ICondition<T> cond)
Filter list elements by specified condition.
Parameters:
Parameter | Type | Description |
---|---|---|
list | java.util.List<T> | A list to process. |
cond | ICondition | Condition used to filter the specified list. |
Returns: java.util.List<T> - Filtered list.
<T>find(List<T> list, ICondition<T> cond, Class clazz)
public static T <T>find(List<T> list, ICondition<T> cond, Class clazz)
Find first occurrence of an list element which satisfy specified condition.
Parameters:
Parameter | Type | Description |
---|---|---|
list | java.util.List<T> | A list to process. |
cond | ICondition | Condition used to find an element in the specified list. |
clazz | java.lang.Class | Class type of element T. |
Returns: T - List element or null.