ArrayList和数组间的相互转换
ArrayList和数组间的相互转换
String s = "360001,光大量化核心,GDLHHX,1,1;360003,光大保德信货币,GDBDXHB,2,1;360008,光大增利收益A,GDZLSYA,1,1;360009,光大增利收益C,GDZLSYC,1,1";
String[] str = s.split(";");for (int i = 0; i < str.length; i++) {
String ss = str[i];
System.out.println(ss);
}
System.out.println("-------------------------------------------------");
String[] abc = new String[] { "张三", "李四", "王五" };
List<String> abcList = new ArrayList<String>(Arrays.asList(abc));
abcList.retainAll(abcList);
for (String string : abcList) {
System.out.println(string.toString());
}
System.out.println("-------------------------------------------------");
List<String> lists = Arrays.asList("张三", "李四", "王五");
for (int i = 0; i < lists.size(); i++) {
System.out.println(lists.get(i));
}
System.out.println("-------------------------------------------------");
List<String> list=new ArrayList<String>();
list.add("王五");
list.add("张三");
list.add("李四");
int size = list.size();
String[] array = list.toArray(new String[size]);
for (int i = 0; i < array.length; i++) {
System.out.println(array[i]);
}
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。