ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java
(Generate patch)

Comparing jsr166/src/main/java/util/concurrent/ConcurrentHashMap.java (file contents):
Revision 1.304 by jsr166, Sun Jan 7 04:59:42 2018 UTC vs.
Revision 1.305 by jsr166, Sun Jan 7 21:42:59 2018 UTC

# Line 688 | Line 688 | public class ConcurrentHashMap<K,V> exte
688       */
689      static Class<?> comparableClassFor(Object x) {
690          if (x instanceof Comparable) {
691 <            Class<?> c; Type[] ts, as; Type t; ParameterizedType p;
691 >            Class<?> c; Type[] ts, as; ParameterizedType p;
692              if ((c = x.getClass()) == String.class) // bypass checks
693                  return c;
694              if ((ts = c.getGenericInterfaces()) != null) {
695 <                for (int i = 0; i < ts.length; ++i) {
696 <                    if (((t = ts[i]) instanceof ParameterizedType) &&
695 >                for (Type t : ts) {
696 >                    if ((t instanceof ParameterizedType) &&
697                          ((p = (ParameterizedType)t).getRawType() ==
698                           Comparable.class) &&
699                          (as = p.getActualTypeArguments()) != null &&
# Line 2545 | Line 2545 | public class ConcurrentHashMap<K,V> exte
2545      }
2546  
2547      final long sumCount() {
2548 <        CounterCell[] as = counterCells; CounterCell a;
2548 >        CounterCell[] as = counterCells;
2549          long sum = baseCount;
2550          if (as != null) {
2551 <            for (int i = 0; i < as.length; ++i) {
2552 <                if ((a = as[i]) != null)
2551 >            for (CounterCell a : as)
2552 >                if (a != null)
2553                      sum += a.value;
2554            }
2554          }
2555          return sum;
2556      }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines