--- jsr166/src/test/loops/MapWordLoops.java 2009/11/02 23:42:46 1.6 +++ jsr166/src/test/loops/MapWordLoops.java 2015/01/15 18:34:19 1.11 @@ -1,10 +1,10 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ -import java.util.*; import java.io.*; +import java.util.*; public class MapWordLoops { @@ -25,7 +25,7 @@ public class MapWordLoops { static final int numTests = 3; public static void main(String[] args) { - Class mapClass = null; + Class mapClass = null; try { mapClass = Class.forName(args[0]); } catch (ClassNotFoundException e) { @@ -42,7 +42,7 @@ public class MapWordLoops { } - static void tests(Class mapClass, int numTests, int sizeIndex) { + static void tests(Class mapClass, int numTests, int sizeIndex) { try { String[] key = readWords(sizeIndex); int size = key.length; @@ -65,8 +65,7 @@ public class MapWordLoops { } } - - static Map newMap(Class cl) { + static Map newMap(Class cl) { try { Map m = (Map)cl.newInstance(); return m; @@ -116,7 +115,7 @@ public class MapWordLoops { long startTime = System.currentTimeMillis(); runner.run(); long afterRun = System.currentTimeMillis(); - long runTime = (afterRun - startTime); + long runTime = afterRun - startTime; int np = runner.total; if (runner.total == runner.hashCode()) System.out.println("Useless Number" + runner.total); @@ -127,7 +126,6 @@ public class MapWordLoops { return runTime; } - static class Runner implements Runnable { final Map map; final String[] key; @@ -148,7 +146,6 @@ public class MapWordLoops { rng = new LoopHelpers.SimpleRandom((id + 1) * 8862213513L); } - int oneStep(int j) { int n = key.length; int r = rng.next() & 0x7FFFFFFF; @@ -177,7 +174,7 @@ public class MapWordLoops { if (r < pctrem) { map.remove(k); ++nremoves; - j += ((r >>> 8) & 7) + n / 2; + j += ((r >>> 8) & 7) + n / 2; if (j >= n) j -= n; } }