【Java基础】将数组转换为List或者LinkedList
2017-08-21 21:22
1266 查看
将数组转换为List:
将List转换为LinkedList:
将LinkedList转换为String
String[] ids = proHist.split("#"); //将ids转化为list集合 Collection<String> collection = Arrays.asList(ids);
将List转换为LinkedList:
LinkedList<String> list = new LinkedList<>(collection);
将LinkedList转换为String
//将linkedlist转换为string StringBuffer sBuffer=new StringBuffer(); for (String string : list) { sBuffer.append(string); } String result = sBuffer.toString(); result=result.substring(0, result.length());
相关文章推荐
- Java 基础集合转换(数组、List、Set、Map相互转换)
- JAVA基础学习之String、StringBuffer、StringBuilder、基本数据类型的使用、整形进制转换、集合Collection、Vector、ArrayList、LinkedList、HashSet、TreeSet等(3)
- Java中toArray的用法探究(java数组与list转换)
- 用string.Join与List<T>或者与string数组转换为字符串
- [java]关于数组和List之间相互转换的方法
- Java基础:数组Array转成List的几种方法
- JAVA的list,set,数组之间的转换
- Java基础小知识——基本数据类型和字符串以及字节数组的转换
- Java基础:数组Array转成List的几种方法
- Java中List转换为数组,数组转List
- Java基础:数组Array转成List的几种方法
- java中数组与List相互转换的方法
- Java基础之集合框架(一)--Collection、List、LinkedList、HashSet
- java将几个数组添加到LinkedList中后再遍历输出
- java中数组与List相互转换的方法
- [Java]JAVA获取实体与List 数组的转换
- Java 数组转换为List
- Java基础小知识——基本数据类型和字符串以及字节数组的转换
- java中把对象、对象bean、list集合、对象数组、Map和Set以及字符串转换成Json
- Java对集合的遍历 List ArryList HashMap LinkedMap JSON 数组等