466 |
|
} |
467 |
|
|
468 |
|
Stream<Job> listJobs(List<Integer> x) { |
469 |
< |
String klazz = x.getClass().getSimpleName(); |
469 |
> |
final String klazz = x.getClass().getSimpleName(); |
470 |
|
return Stream.of( |
471 |
|
new Job(klazz + " subList toArray()") { |
472 |
|
public void work() throws Throwable { |
508 |
|
sum += (Integer) o; |
509 |
|
return sum; }) |
510 |
|
.sum(); |
511 |
< |
check.sum(total);}}}); |
511 |
> |
check.sum(total);}}}, |
512 |
> |
new Job(klazz + " indexOf") { |
513 |
> |
public void work() throws Throwable { |
514 |
> |
int[] sum = new int[1]; |
515 |
> |
Object y = new Object() { |
516 |
> |
public boolean equals(Object z) { |
517 |
> |
sum[0] += (int) z; return false; }}; |
518 |
> |
for (int i = 0; i < iterations; i++) { |
519 |
> |
sum[0] = 0; |
520 |
> |
if (x.indexOf(y) != -1) throw new AssertionError(); |
521 |
> |
check.sum(sum[0]);}}}, |
522 |
> |
new Job(klazz + " lastIndexOf") { |
523 |
> |
public void work() throws Throwable { |
524 |
> |
int[] sum = new int[1]; |
525 |
> |
Object y = new Object() { |
526 |
> |
public boolean equals(Object z) { |
527 |
> |
sum[0] += (int) z; return false; }}; |
528 |
> |
for (int i = 0; i < iterations; i++) { |
529 |
> |
sum[0] = 0; |
530 |
> |
if (x.lastIndexOf(y) != -1) throw new AssertionError(); |
531 |
> |
check.sum(sum[0]);}}}); |
532 |
|
} |
533 |
|
} |