码迷,mamicode.com
首页 > 其他好文 > 详细

List<?> 转换成List<Student>

时间:2015-03-18 15:57:57      阅读:252      评论:0      收藏:0      [点我收藏+]

标签:object

    	String sql = "select * from student";
    	list = this.TreeService.getTreeList(sql);
    	//slist = dwg(list);
    	
    	for(int i=0; i<list.size(); i++){
    		Student student =new Student();
    		Object[] objects = (Object[]) list.get(i);
    		student.setId(((Integer)objects[0]).intValue());
    		student.setName(objects[1].toString());
    		student.setClass_id(((Integer)objects[2]).intValue());
//    		student.setId(i);
//    		student.setName("人员"+i);
//    		student.setClass_id(i);
    		System.out.println("student值: "+student.getId()+student.getName()+student.getClass_id());
    		//Student student = (Student) list.get(i);
    		slist.add(student);
    		System.out.println("----nmd5----");
    	}

List<?> 转换成List<Student>

标签:object

原文地址:http://blog.csdn.net/ahhmdwg/article/details/44410405

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!