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

Comparing jsr166/src/test/loops/MapWordLoops.java (file contents):
Revision 1.5 by jsr166, Thu Oct 29 23:09:07 2009 UTC vs.
Revision 1.10 by jsr166, Wed Dec 31 17:00:58 2014 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 MapWordLoops {
10  
# Line 25 | Line 25 | public class MapWordLoops {
25      static final int numTests = 3;
26  
27      public static void main(String[] args) {
28 <        Class mapClass = null;
28 >        Class<?> mapClass = null;
29          try {
30              mapClass = Class.forName(args[0]);
31 <        } catch(ClassNotFoundException e) {
31 >        } catch (ClassNotFoundException e) {
32              throw new RuntimeException("Class " + args[0] + " not found.");
33          }
34  
# Line 42 | Line 42 | public class MapWordLoops {
42  
43      }
44  
45 <    static void tests(Class mapClass, int numTests, int sizeIndex) {
45 >    static void tests(Class<?> mapClass, int numTests, int sizeIndex) {
46          try {
47              String[] key = readWords(sizeIndex);
48              int size = key.length;
# Line 66 | Line 66 | public class MapWordLoops {
66      }
67  
68  
69 <    static Map<String,String> newMap(Class cl) {
69 >    static Map<String,String> newMap(Class<?> cl) {
70          try {
71              Map m = (Map<String,String>)cl.newInstance();
72              return m;
73 <        } catch(Exception e) {
73 >        } catch (Exception e) {
74              throw new RuntimeException("Can't instantiate " + cl + ": " + e);
75          }
76      }
77  
78      static void pause() {
79 <        try { Thread.sleep(100); } catch(InterruptedException ie) { return; }
79 >        try { Thread.sleep(100); }
80 >        catch (InterruptedException ie) { return; }
81      }
82  
83      static String[] readWords(int sizeIndex) throws IOException {
# Line 115 | Line 116 | public class MapWordLoops {
116          long startTime = System.currentTimeMillis();
117          runner.run();
118          long afterRun = System.currentTimeMillis();
119 <        long runTime =  (afterRun - startTime);
119 >        long runTime = afterRun - startTime;
120          int np = runner.total;
121          if (runner.total == runner.hashCode())
122              System.out.println("Useless Number" + runner.total);
# Line 176 | Line 177 | public class MapWordLoops {
177                  if (r < pctrem) {
178                      map.remove(k);
179                      ++nremoves;
180 <                    j += ((r >>> 8) & 7) +  n / 2;
180 >                    j += ((r >>> 8) & 7) + n / 2;
181                      if (j >= n) j -= n;
182                  }
183              }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines