Thinking in java学习笔记之set
Random rand = new Random(47);
Set<Integer> set = new HashSet<Integer>();
for(int i=0;i<10000;i++){
set.add(rand.nextInt(30));
System.out.println(set);
}
//输出
/*
[8]
[5, 8]
[5, 8, 13]
[5, 8, 11, 13]
[1, 5, 8, 11, 13]
[1, 5, 8, 11, 13, 29]
[1, 5, 8, 11, 28, 13, 29]
[1, 20, 5, 8, 11, 28, 13, 29]
[1, 20, 5, 8, 11, 28, 12, 13, 29]
[1, 20, 5, 7, 8, 11, 28, 12, 13, 29]
[1, 18, 20, 5, 7, 8, 11, 28, 12, 13, 29]
[1, 18, 20, 5, 7, 8, 11, 28, 12, 13, 29]
*/


2.应用


本博客仅供本人学习、记录,如有错误,恳请指出。欢迎关注公众号:程序员生活

浙公网安备 33010602011771号