--- jsr166/src/test/loops/MapCheck.java 2009/10/29 23:09:07 1.6 +++ jsr166/src/test/loops/MapCheck.java 2009/11/02 23:51:32 1.9 @@ -9,7 +9,7 @@ * * When run with "s" second arg, this requires file "testwords", which * is best used with real words. We can't check in this file, but you - * can create one from a real dictonary (1 line per word) and then run + * can create one from a real dictionary (1 line per word) and then run * linux "shuf" to randomize entries. */ import java.util.*; @@ -40,7 +40,7 @@ public class MapCheck { if (args.length > 0) { try { mapClass = Class.forName(args[0]); - } catch(ClassNotFoundException e) { + } catch (ClassNotFoundException e) { throw new RuntimeException("Class " + args[0] + " not found."); } } @@ -99,8 +99,8 @@ public class MapCheck { static Map newMap() { try { - return (Map)mapClass.newInstance(); - } catch(Exception e) { + return (Map) mapClass.newInstance(); + } catch (Exception e) { throw new RuntimeException("Can't instantiate " + mapClass + ": " + e); } } @@ -134,7 +134,7 @@ public class MapCheck { try { m.put(null, x); v = m.get(null); - } catch(NullPointerException npe) { + } catch (NullPointerException npe) { System.out.println("Map does not allow null keys"); return; } @@ -164,7 +164,7 @@ public class MapCheck { Map intMap = (Map)s; timer.start(nm, n); for (int i = 0; i < n; i++) { - if ((Integer)(intMap.get(i)) != i) ++sum; + if ((Integer) (intMap.get(i)) != i) ++sum; } timer.finish(); reallyAssert (sum == expect); @@ -350,7 +350,7 @@ public class MapCheck { FileInputStream is = new FileInputStream("MapCheck.dat"); ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(is)); - Map m = (Map)in.readObject(); + Map m = (Map) in.readObject(); long endTime = System.currentTimeMillis(); long time = endTime - startTime; @@ -651,8 +651,8 @@ public class MapCheck { static void printStats() { for (Iterator it = accum.entrySet().iterator(); it.hasNext(); ) { - Map.Entry e = (Map.Entry)(it.next()); - Stats stats = ((Stats)(e.getValue())); + Map.Entry e = (Map.Entry) it.next(); + Stats stats = (Stats) e.getValue(); System.out.print(e.getKey() + ": "); long s; long n = stats.number; @@ -682,7 +682,7 @@ public class MapCheck { if (st == null) accum.put(name, new Stats(elapsed, numOps)); else - ((Stats)st).addTime(elapsed, numOps); + ((Stats) st).addTime(elapsed, numOps); } }