Thinking in java学习笔记之set
Posted yansum
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章
Thinking in java学习笔记之interface
Thinking in Java,Fourth Edition(Java 编程思想,第四版)学习笔记(十四)之Type Information