0808xyj的专栏

Coding Changes the World

Java 数组Array 转换为 List


方法一:

      String[] words = {"I", "am", "a", "new", "student"};
  
      List<String> wordList = Arrays.asList(words);

方法二:

     List arrList = new ArrayList();
     String[] strArray = new String[] {"Java", "World"};
 
     Collections.addAll(arrList, strArray);

方法三:

    String[] words = {"I", "am", "a", "new", "student"};
    List<String> list = new ArrayList<String>();
    for (String s : words) {
        list.add(s);
    }


阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/xyj0808xyj/article/details/49937129
个人分类: Java
上一篇JavaScript 中splice()方法增删数组元素
下一篇Oracle ORA-06502 数字或值错误:字符串缓冲区太小
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭