zoukankan      html  css  js  c++  java
  • object转化为string

     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 }
    ---- 动动手指关注我!或许下次你又能在我这里找到你需要的答案!ZZZZW与你一起学习,一起进步!
  • 相关阅读:
    python 单例模式
    JAVA基础知识总结
    java环境配置
    VScode输出中文乱码的解决方法------测试过可以用
    centos7 单独安装pip
    pyqt5信号与槽
    桌面程序显示到前台
    下载哔哩哔哩视频
    pyqt5 designer安装步骤
    树莓派配置静态wifi地址
  • 原文地址:https://www.cnblogs.com/zzzzw/p/4722310.html
Copyright © 2011-2022 走看看