--- jsr166/src/test/loops/MapCheck.java 2009/10/29 23:11:03 1.7 +++ jsr166/src/test/loops/MapCheck.java 2009/11/03 01:04:02 1.11 @@ -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 (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; @@ -610,7 +610,7 @@ public class MapCheck { abs[ai++] = s; break; } - sb.append((char)c); + sb.append((char) c); } } in.close(); @@ -629,15 +629,15 @@ public class MapCheck { char[] c = new char[len * 4 + 1]; for (int j = 1; j < len; ++j) { int r = srng.next(); - c[k++] = (char)(' ' + (r & 0x7f)); + c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; - c[k++] = (char)(' ' + (r & 0x7f)); + c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; - c[k++] = (char)(' ' + (r & 0x7f)); + c[k++] = (char) (' ' + (r & 0x7f)); r >>>= 8; - c[k++] = (char)(' ' + (r & 0x7f)); + c[k++] = (char) (' ' + (r & 0x7f)); } - c[k++] = (char)((i & 31) | 1); // never == to any testword + c[k++] = (char) ((i & 31) | 1); // never == to any testword ws[i] = new String(c); } } @@ -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; @@ -663,7 +663,7 @@ public class MapCheck { else s = stats.sum; - double t = ((double)s) / n; + double t = ((double) s) / n; long nano = Math.round(t); System.out.printf("%6d", + nano); System.out.println(); @@ -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); } }