389 |
|
it.remove(); |
390 |
|
} |
391 |
|
check.sum(sum[0]);}}}, |
392 |
+ |
new Job(description + " Iterator.remove-rnd-two-pass") { |
393 |
+ |
public void work() throws Throwable { |
394 |
+ |
ThreadLocalRandom rnd = ThreadLocalRandom.current(); |
395 |
+ |
Collection<Integer> x = supplier.get(); |
396 |
+ |
int[] sum = new int[1]; |
397 |
+ |
for (int i = 0; i < iterations; i++) { |
398 |
+ |
sum[0] = 0; |
399 |
+ |
x.addAll(al); |
400 |
+ |
Iterator<Integer> it = x.iterator(); |
401 |
+ |
while (it.hasNext()) { |
402 |
+ |
if (rnd.nextBoolean()) { |
403 |
+ |
sum[0] += it.next(); |
404 |
+ |
it.remove(); |
405 |
+ |
} |
406 |
+ |
} |
407 |
+ |
while (it.hasNext()) { |
408 |
+ |
sum[0] += it.next(); |
409 |
+ |
it.remove(); |
410 |
+ |
} |
411 |
+ |
it = x.iterator(); |
412 |
+ |
check.sum(sum[0]);}}}, |
413 |
|
new Job(description + " clear") { |
414 |
|
public void work() throws Throwable { |
415 |
|
Collection<Integer> x = supplier.get(); |