Package com.linkare.commons.utils
Class CollectionUtils
- java.lang.Object
-
- com.linkare.commons.utils.CollectionUtils
-
public class CollectionUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description CollectionUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.commons.collections.TransformergetToStringTransformer()Transformer that converts any object in a String representation of itself, using the toString method of the object.static <F,T>
T[]getTransformedArrayFromArray(F[] list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)Transform an array of objects from one type to an array of objects of another type, using a given transformer.static <F,T>
T[]getTransformedArrayFromList(List<F> list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)Transform a list of objects from one type to an array of another type, using a given transformer.static <F,T>
List<T>getTransformedListFromArray(F[] list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)Transform an array of objects from one type to a list of objects of another type, using a given transformer.static <F,T>
List<T>getTransformedListFromList(List<F> list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)Transform a list of objects from one type to a list of objects of another type, using a given transformer.
-
-
-
Method Detail
-
getTransformedArrayFromList
public static <F,T> T[] getTransformedArrayFromList(List<F> list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)
Transform a list of objects from one type to an array of another type, using a given transformer.- Type Parameters:
F- Type from which the elements are converted.T- Type to which the elements will be converted.- Parameters:
list- List of elements to be converted.transformer- Transformer used to convert each element.clazz- Class to which the elements will be transformed.- Returns:
- The array with all elements from the base list converted to the T type.
-
getTransformedListFromArray
public static <F,T> List<T> getTransformedListFromArray(F[] list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)
Transform an array of objects from one type to a list of objects of another type, using a given transformer.- Type Parameters:
F- Type from which the elements are converted.T- Type to which the elements will be converted.- Parameters:
list- Array of elements to be converted.transformer- Transformer used to convert each element.clazzlist- Class to which the elements will be transformed.- Returns:
- The list with all elements from the base array converted to the T type.
-
getTransformedArrayFromArray
public static <F,T> T[] getTransformedArrayFromArray(F[] list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)Transform an array of objects from one type to an array of objects of another type, using a given transformer.- Type Parameters:
F- Type from which the elements are converted.T- Type to which the elements will be converted.- Parameters:
list- Array of elements to be converted.transformer- Transformer used to convert each element.clazz- Class to which the elements will be transformed.- Returns:
- The array with all elements from the base array converted to the T type.
-
getTransformedListFromList
public static <F,T> List<T> getTransformedListFromList(List<F> list, org.apache.commons.collections.Transformer transformer, Class<T> clazz)
Transform a list of objects from one type to a list of objects of another type, using a given transformer.- Type Parameters:
F- Type from which the elements are converted.T- Type to which the elements will be converted.- Parameters:
list- List of elements to be converted.transformer- Transformer used to convert each element.clazz- Class to which the elements will be transformed.- Returns:
- The list with all elements from the base list converted to the T type.
-
getToStringTransformer
public static org.apache.commons.collections.Transformer getToStringTransformer()
Transformer that converts any object in a String representation of itself, using the toString method of the object.- Returns:
-
-