ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/IteratorLoops.java
(Generate patch)

Comparing jsr166/src/test/loops/IteratorLoops.java (file contents):
Revision 1.2 by jsr166, Tue Nov 29 08:58:22 2005 UTC vs.
Revision 1.4 by dl, Fri Oct 23 19:57:06 2009 UTC

# Line 17 | Line 17 | import java.util.*;
17  
18   public final class IteratorLoops {
19      static final int DEFAULT_SIZE = 16384;
20 <    static final int DEFAULT_TRIALS = 2;
20 >    static final int DEFAULT_TRIALS = 4;
21      static final int NC = 16; // number of collections must be power of 2
22      static volatile long mismatches = 0;
23      static int randomSeed = 3122688;
# Line 35 | Line 35 | public final class IteratorLoops {
35          Collection<Integer>[] colls =
36              (Collection<Integer>[])new Collection[NC];
37  
38 <        for (int k = 0; k < colls.length; ++k)
39 <            colls[k] = (Collection<Integer>)klass.newInstance();
38 >        for (int k = 0; k < colls.length; ++k) {
39 >            Object x = klass.newInstance();
40 >            if (x instanceof Collection)
41 >                colls[k] = (Collection<Integer>)x;
42 >            else if (x instanceof Map)
43 >                colls[k] = (Collection<Integer>)Collections.newSetFromMap((Map)x);
44 >            else
45 >                throw new Error("bad class");
46 >        }
47  
48          for (int i = 0; i < t; ++i)
49              new IteratorLoops(colls).oneRun(n);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines