ListUtils

Inheritance: java.lang.Object

public class ListUtils

Utility class for list processing.

Methods

MethodDescription
<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:

ParameterTypeDescription
listjava.util.List<T>List to process.
algorithmIAlgorithmApplied algorithm.
startIndexintStart 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:

ParameterTypeDescription
listjava.util.List<T>A list to process.
condIConditionCondition 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:

ParameterTypeDescription
listjava.util.List<T>A list to process.
condIConditionCondition used to find an element in the specified list.
clazzjava.lang.ClassClass type of element T.

Returns: T - List element or null.