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

object转化为string

时间:2015-08-11 22:44:37      阅读:92      评论:0      收藏:0      [点我收藏+]

标签:

 1 package common;
 2 
 3 import java.util.ArrayList;
 4 import java.util.List;
 5 
 6 public class DataZh {
 7    
 8     
 9     public static List<String> ObjecttoString(List<Object> o)
10     {
11         List<String> x = new ArrayList<String>();
12         for(Object oj: o){
13             x.add(oj.toString());
14         }
15         return x;
16     }
17     
18     
19     public static List<String[]> ObjectAtoStringA(List<Object[]> o)
20     {
21         List<String[]> x = new ArrayList<String[]>();
22         for(Object[] oj:o){
23             String[] temp = new String[oj.length];
24             for(int i = 0; i < oj.length; i++){
25                 temp[i] = oj[i].toString();
26             }
27             x.add(temp);
28         }
29         return x;
30     }
31 //    for(Object o : array)
32 //    { System.out.println(o);}
33 //    这是jdk1.6里面新增的功能:增强的for循环.
34 //    其实就是一个一个的把array里面的元素取出来,o就是你取出来的那个元素.
35 //36 //    for(int i=0;i<array.size();i++){
37 //            Object o = array.get(i);
38 //
39 //            System.out.println(o);
40 //
41 //    }
42 //    是一样的.
43 //    }
44     
45 }

 

object转化为string

标签:

原文地址:http://www.cnblogs.com/zzzzw/p/4722310.html

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