--- jsr166/src/test/loops/IteratorLoops.java 2011/03/15 19:47:05 1.9 +++ jsr166/src/test/loops/IteratorLoops.java 2015/08/10 07:24:02 1.13 @@ -14,7 +14,6 @@ import java.util.*; * and long iterators. Reports include times for adds and other * checks, so overestimate times per iteration. */ - public final class IteratorLoops { static final int DEFAULT_SIZE = 16384; static final int DEFAULT_TRIALS = 4; @@ -23,7 +22,7 @@ public final class IteratorLoops { static int randomSeed = 3122688; public static void main(String[] args) throws Exception { - Class klass = Class.forName(args[0]); + Class klass = Class.forName(args[0]); int n = (args.length <= 1) ? DEFAULT_SIZE : Integer.parseInt(args[1]); int t = (args.length <= 2) ? DEFAULT_TRIALS : Integer.parseInt(args[2]); @@ -33,7 +32,7 @@ public final class IteratorLoops { System.out.println(); Collection[] colls = - (Collection[])new Collection[NC]; + (Collection[])new Collection[NC]; for (int k = 0; k < colls.length; ++k) { Object x = klass.newInstance(); @@ -87,8 +86,8 @@ public final class IteratorLoops { int counts() { int count = 0; for (int k = 0; k < cs.length; ++k) { - for (Iterator it = cs[k].iterator(); it.hasNext();) { - if (it.next() != null) + for (Integer x : cs[k]) { + if (x != null) ++count; } } @@ -123,6 +122,4 @@ public final class IteratorLoops { try { Thread.sleep(500); } catch (Exception ex) { return; } } - - }