diff --git a/src/main/java/gr/james/sampling/ChaoSampling.java b/src/main/java/gr/james/sampling/ChaoSampling.java index fca04ce..62b6b07 100644 --- a/src/main/java/gr/james/sampling/ChaoSampling.java +++ b/src/main/java/gr/james/sampling/ChaoSampling.java @@ -152,7 +152,8 @@ public boolean feed(T item, double weight) { // The first k items go straight into the A list if (this.impossible.size() + this.sample.size() < sampleSize) { assert this.sample.isEmpty(); - this.impossible.add(new Weighted<>(item, weight)); + final boolean added = this.impossible.add(new Weighted<>(item, weight)); + assert added; return true; } @@ -202,7 +203,8 @@ public boolean feed(T item, double weight) { if (w >= 1) { // New item is overweight and will be placed in A - this.impossible.add(new Weighted<>(item, weight)); + final boolean added = this.impossible.add(new Weighted<>(item, weight)); + assert added; } else if (w > add) { // New item is feasible and will be placed in C this.sample.add(item);