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

Method CircularSet

lowlevel/CircularSet.java:12–18  ·  view source on GitHub ↗
(int size)

Source from the content-addressed store, hash-verified

10 private int size;
11 private int index = 0;
12 public CircularSet(int size) {
13 this.size = size;
14 array = new int[size];
15 // Initialize to a value not produced
16 // by SerialNumbers:
17 Arrays.fill(array, -1);
18 }
19 public synchronized void add(int i) {
20 array[index] = i;
21 // Wrap index and write over old elements:

Callers

nothing calls this directly

Calls 1

fillMethod · 0.65

Tested by

no test coverage detected