java
/**
* object转list
*
* @param obj
* @param clazz
* @param <T>
* @return
*/
public static <T> List<T> castList(Object obj, Class<T> clazz) {
List<T> result = new ArrayList<T>();
if (obj instanceof List<?>) {
for (Object o : (List<?>) obj) {
result.add(clazz.cast(o));
}
return result;
}
return null;
}
标签:Java,List,object,list,param,clazz,obj
From: https://www.cnblogs.com/18sui/p/17115249.html