标签:java
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);
}
}
}
标签:java
原文地址:http://blog.51cto.com/5731674/2087532