MCPcopy Index your code
hub / github.com/BruceEckel/OnJava8-Examples / main

Method main

streams/ImperativeRandoms.java:8–17  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

6
7public class ImperativeRandoms {
8 public static void main(String[] args) {
9 Random rand = new Random(47);
10 SortedSet<Integer> rints = new TreeSet<>();
11 while(rints.size() < 7) {
12 int r = rand.nextInt(20);
13 if(r < 5) continue;
14 rints.add(r);
15 }
16 System.out.println(rints);
17 }
18}
19/* Output:
20[7, 8, 9, 11, 13, 15, 18]

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected