String数组转List对象集合

T user(name,age)
List data = ['zhangsan',22,'lisi',23]
List=List
/**
*List data
*Class clazz
**/
private  List stringArray2List(List data, Class clazz) throws Exception {
    List ts = new ArrayList<>();
    Field[] fields = clazz.getDeclaredFields();
    int len = data.size()/fields.length;
    int m = data.size()%fields.length;
    if(m>0){
        len = len+1;
    }
    for(int i=0;i 
 

你可能感兴趣的:(Java)