首页 > 代码库 > Thinking in java学习笔记之set

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.应用

技术分享

技术分享

 

Thinking in java学习笔记之set