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

Comparing jsr166/src/test/loops/CollectionWordLoops.java (file contents):
Revision 1.5 by jsr166, Mon Nov 2 23:51:32 2009 UTC vs.
Revision 1.11 by jsr166, Mon Aug 10 03:13:33 2015 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6 import java.util.*;
6   import java.io.*;
7 + import java.util.*;
8  
9   public class CollectionWordLoops {
10  
# Line 23 | Line 23 | public class CollectionWordLoops {
23      static final int numTests  = 2;
24  
25      public static void main(String[] args) {
26 <        Class collectionClass = null;
26 >        Class<?> collectionClass = null;
27          try {
28              collectionClass = Class.forName(args[0]);
29          } catch (ClassNotFoundException e) {
# Line 37 | Line 37 | public class CollectionWordLoops {
37  
38          for (int s = WORDS_FILES.length-1; s >= 0; --s)
39              tests(collectionClass, numTests, s);
40
40      }
41  
42 <    static void tests(Class collectionClass, int numTests, int sizeIndex) {
42 >    static void tests(Class<?> collectionClass, int numTests, int sizeIndex) {
43          try {
44              String[] key = readWords(sizeIndex);
45              int size = key.length;
# Line 63 | Line 62 | public class CollectionWordLoops {
62          }
63      }
64  
65 <
67 <    static Collection<String> newCollection(Class cl) {
65 >    static Collection<String> newCollection(Class<?> cl) {
66          try {
67              Collection m = (Collection<String>) cl.newInstance();
68              return m;
# Line 114 | Line 112 | public class CollectionWordLoops {
112          long startTime = System.currentTimeMillis();
113          runner.run();
114          long afterRun = System.currentTimeMillis();
115 <        long runTime =  (afterRun - startTime);
115 >        long runTime = afterRun - startTime;
116          int np = runner.total;
117          if (runner.total == runner.hashCode())
118              System.out.println("Useless Number" + runner.total);
# Line 125 | Line 123 | public class CollectionWordLoops {
123          return runTime;
124      }
125  
128
126      static class Runner implements Runnable {
127          final Collection<String> collection;
128          final String[] key;
# Line 145 | Line 142 | public class CollectionWordLoops {
142              pctins = (int)(((long)pinsert * (long)(Integer.MAX_VALUE/2)) / 50);
143          }
144  
148
145          int oneStep(int j) {
146              int n = key.length;
147              int r = rng.next() & 0x7FFFFFFF;
# Line 173 | Line 169 | public class CollectionWordLoops {
169                  if (r < pctrem) {
170                      collection.remove(k);
171                      ++nremoves;
172 <                    j += ((r >>> 8) & 7) +  n / 2;
172 >                    j += ((r >>> 8) & 7) + n / 2;
173                      if (j >= n) j -= n;
174                  }
175              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines