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

Method run

lowlevel/SerialNumberChecker.java:15–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13 this.producer = producer;
14 }
15 @Override public void run() {
16 while(true) {
17 int serial = producer.nextSerialNumber();
18 if(serials.contains(serial)) {
19 System.out.println("Duplicate: " + serial);
20 System.exit(0);
21 }
22 serials.add(serial);
23 }
24 }
25 static void test(SerialNumbers producer) {
26 for(int i = 0; i < 10; i++)
27 CompletableFuture.runAsync(

Callers

nothing calls this directly

Calls 3

containsMethod · 0.80
nextSerialNumberMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected