2015-04-20 15:36:01 -07:00
|
|
|
|
//: holding/SetOfInteger.java
|
2015-05-29 14:18:51 -07:00
|
|
|
|
// <20>2015 MindView LLC: see Copyright.txt
|
2015-04-20 15:36:01 -07:00
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
public class SetOfInteger {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
|
Random rand = new Random(47);
|
2015-05-05 11:20:13 -07:00
|
|
|
|
Set<Integer> intset = new HashSet<>();
|
2015-04-20 15:36:01 -07:00
|
|
|
|
for(int i = 0; i < 10000; i++)
|
|
|
|
|
intset.add(rand.nextInt(30));
|
|
|
|
|
System.out.println(intset);
|
|
|
|
|
}
|
|
|
|
|
} /* Output:
|
2015-05-05 11:20:13 -07:00
|
|
|
|
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 16, 19, 18, 21, 20, 23, 22, 25, 24, 27, 26, 29, 28]
|
2015-04-20 15:36:01 -07:00
|
|
|
|
*///:~
|