Java 实例 - 数组转集合
Java 教程
· 2019-02-11 15:13:30
以下实例演示了使用 Java Util 类的 Arrays.asList(name) 方法将数组转换为集合:
ArrayToCollection.java 文件
import java.util.*;
import java.io.*;
public class ArrayToCollection{
public static void main(String args[])
throws IOException{
int n = 5; // 5 个元素
String[] name = new String[n];
for(int i = 0; i < n; i++){
name[i] = String.valueOf(i);
}
List<String> list = Arrays.asList(name);
System.out.println();
for(String li: list){
String str = li;
System.out.print(str + " ");
}
}
}
以上代码运行输出结果为:
0 1 2 3 4
点击查看所有 Java 教程 文章: https://www.codercto.com/courses/l/12.html
Producing Masculinity
Michele White / Routledge / 2019-3 / $39.95
Thoughtful, witty, and illuminating, in this book Michele White explores the ways normative masculinity is associated with computers and the Internet and is a commonly enacted online gender practice. ......一起来看看 《Producing Masculinity》 这本书的介绍吧!