public class BeanUtil {
public BeanUtil() {
}
public static <T> List<T> copyToList(Collection<?> collection, Class<T> targetType, CopyOptions copyOptions) {
if (null == collection) {
return null;
} else {
return (List)(collection.isEmpty() ? new ArrayList(0) : (List)collection.stream().map((source) -> {
T target = ReflectUtil.newInstanceIfPossible(targetType);
copyProperties(source, target, copyOptions);
return target;
}).collect(Collectors.toList()));
}
}
}
List<MyClass> reports = BeanUtil.copyToList(datas, MyClass.class, null);