ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collection/IteratorMicroBenchmark.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collection/IteratorMicroBenchmark.java (file contents):
Revision 1.15 by jsr166, Thu Dec 29 02:24:28 2016 UTC vs.
Revision 1.16 by jsr166, Tue Jan 3 06:27:57 2017 UTC

# Line 334 | Line 334 | public class IteratorMicroBenchmark {
334                      int[] sum = new int[1];
335                      for (int i = 0; i < iterations; i++) {
336                          sum[0] = 0;
337 <                        x.removeIf(n -> { sum[0] += n; return false; });
337 >                        if (x.removeIf(n -> { sum[0] += n; return false; }))
338 >                            throw new AssertionError();
339                          check.sum(sum[0]);}}},
340              new Job(klazz + " .contains") {
341                  public void work() throws Throwable {
# Line 344 | Line 345 | public class IteratorMicroBenchmark {
345                              sum[0] += (int) z; return false; }};
346                      for (int i = 0; i < iterations; i++) {
347                          sum[0] = 0;
348 <                        x.contains(y);
348 >                        if (x.contains(y)) throw new AssertionError();
349 >                        check.sum(sum[0]);}}},
350 >            new Job(klazz + " .remove(Object)") {
351 >                public void work() throws Throwable {
352 >                    int[] sum = new int[1];
353 >                    Object y = new Object() {
354 >                        public boolean equals(Object z) {
355 >                            sum[0] += (int) z; return false; }};
356 >                    for (int i = 0; i < iterations; i++) {
357 >                        sum[0] = 0;
358 >                        if (x.remove(y)) throw new AssertionError();
359                          check.sum(sum[0]);}}},
360              new Job(klazz + " .forEach") {
361                  public void work() throws Throwable {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines