参考:https://jxdwuao.iteye.com/blog/1140400
开发时, 很多时候我们需要实现 List 的复制, 如果使用For循环复制, 需要写好几行代码, 也不能复用 .
其实我们可以借助泛型写一个通用的方法, 以后都可使用这个方法实现List 的复制 .
import org.apache.commons.beanutils.BeanUtils;
public new copy(old) throws IllegalAccessException, InvocationTargetException{
BeanUtils.copyProperties(new, old);
}