xyz.felh.utils.ListUtils Maven / Gradle / Ivy
package xyz.felh.utils;
import java.util.ArrayList;
import java.util.List;
public class ListUtils {
/**
* Cast object to List
*
* @param obj object
* @param clazz class
* @param Type
* @return the list
*/
public static List castList(Object obj, Class clazz) {
List result = new ArrayList<>();
if (obj instanceof List>) {
for (Object o : (List>) obj) {
result.add(clazz.cast(o));
}
return result;
}
return null;
}
}