package Collection;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
public class ArrayToConnection {
public static void main(String[] args) {
String[] str = {"java", "php", "c++"};
//数组转集合
List<String> list = Arrays.asList(str);
Iterator<String> it = list.iterator();
while (it.hasNext()){
String value = it.next();
System.out.println(value);
}
//集合转数组
String[] str2 = (String[]) list.toArray();
for (String s : str2) {
System.out.println(s);
}
}
}
本文转自屌丝逆袭博客51CTO博客,原文链接http://blog.51cto.com/5731674/2087532如需转载请自行联系原作者
_追随我心