--- jsr166/src/extra166y/CustomConcurrentHashMap.java 2009/11/02 11:47:36 1.7 +++ jsr166/src/extra166y/CustomConcurrentHashMap.java 2011/12/05 04:08:47 1.20 @@ -1,7 +1,7 @@ /* * 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/ */ package extra166y; @@ -53,10 +53,10 @@ import sun.misc.Unsafe; * (STRONG, * new Equivalence() { * public boolean equal(Person k, Object x) { - * return x instanceOf Person && k.name.equals(((Person)x).name); + * return x instanceof Person && k.name.equals(((Person)x).name); * } * public int hash(Object x) { - * return (x instanceOf Person)? ((Person)x).name.hashCode() : 0; + * return (x instanceof Person) ? ((Person)x).name.hashCode() : 0; * } * }, * STRONG, EQUALS, 0); @@ -236,7 +236,7 @@ public class CustomConcurrentHashMap MAX_SEGMENT_CAPACITY) - capacity = MAX_SEGMENT_CAPACITY; + capacity = MAX_SEGMENT_CAPACITY; this.initialSegmentCapacity = capacity; } this.segments = (Segment[])new Segment[NSEGMENTS]; @@ -642,7 +642,7 @@ public class CustomConcurrentHashMap>> SEGMENT_SHIFT) & SEGMENT_MASK; Segment seg = segs[index]; if (seg == null) { - synchronized(segs) { + synchronized (segs) { seg = segs[index]; if (seg == null) { seg = new Segment(); @@ -1010,7 +1010,7 @@ public class CustomConcurrentHashMap= Integer.MAX_VALUE? Integer.MAX_VALUE : (int)sum; + return (sum >= Integer.MAX_VALUE) ? Integer.MAX_VALUE : (int) sum; } /** @@ -1069,7 +1069,7 @@ public class CustomConcurrentHashMap * if (map.containsKey(key)) @@ -1158,7 +1158,7 @@ public class CustomConcurrentHashMap * map.compute(word, new RemappingFunction<String,Integer>() { * public Integer remap(String k, Integer v) { - * return v == null? 1 : v + 1; + * return (v == null) ? 1 : v + 1; * }}); * * @@ -1414,7 +1414,8 @@ public class CustomConcurrentHashMap e = (Map.Entry)o; - return CustomConcurrentHashMap.this.remove(e.getKey(), e.getValue()); + return CustomConcurrentHashMap.this.remove(e.getKey(), + e.getValue()); } public int size() { return CustomConcurrentHashMap.this.size(); @@ -1550,15 +1551,15 @@ public class CustomConcurrentHashMap e : entrySet()) { s.writeObject(e.getKey()); @@ -1569,11 +1570,11 @@ public class CustomConcurrentHashMap