/**
* warning suppression
* "The expression of type List needs unchecked conversion to conform to List<?>"
*
* @param <T>
* @param c
* @param clazz
* @return
*/
public static <T> List<T> castList(Collection<?> c, Class<? extends T> clazz) {
List<T> r = new ArrayList<T>(c.size());
for (Object o : c) {
r.add(clazz.cast(o));
}
return r;
}
warning suppression"The expression of type List needs unchecked .."
最新推荐文章于 2024-11-26 09:51:28 发布