码迷,mamicode.com
首页 > 编程语言 > 详细

将List转换为二维数组(result)

时间:2015-04-26 22:38:10      阅读:165      评论:0      收藏:0      [点我收藏+]

标签:

 

result的数据结构为List<Map<String,Object>>

 

            //将List转换为二维数组String[][]
              String[][] z = new String[result.size()][];  
              
                 for(int i=0;i<z.length;i++){
                  
                  Map m = (Map)result.get(i);
                  Set set = m.keySet();
                  z[i] = new String[m.size()];
                  Iterator it =set.iterator();
                
                 for(int j=0;it.hasNext();j++){
                     String s = (String)it.next();
                     if(m.get(s)!=null){
                         z[i][j] =m.get(s).toString();
                     }
                  }
              }

 

将List转换为二维数组(result)

标签:

原文地址:http://www.cnblogs.com/otio/p/4458477.html

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