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.271 by dl, Tue Apr 28 23:06:53 2015 UTC vs.
Revision 1.272 by dl, Wed Apr 29 10:42:15 2015 UTC

# Line 1614 | Line 1614 | public class ConcurrentHashMap<K,V> exte
1614      }
1615  
1616      /**
1617 +     * Helper method for Values.removeIf
1618 +     */
1619 +    boolean removeValueIf(Predicate<? super  V> function) {
1620 +        if (function == null) throw new NullPointerException();
1621 +        Node<K,V>[] t;
1622 +        boolean removed = false;
1623 +        if ((t = table) != null) {
1624 +            Traverser<K,V> it = new Traverser<K,V>(t, t.length, 0, t.length);
1625 +            for (Node<K,V> p; (p = it.advance()) != null; ) {
1626 +                K k = p.key;
1627 +                V v = p.val;
1628 +                if (function.test(v) && replaceNode(k, null, v) != null)
1629 +                    removed = true;
1630 +            }
1631 +        }
1632 +        return removed;
1633 +    }
1634 +
1635 +    /**
1636       * If the specified key is not already associated with a value,
1637       * attempts to compute its value using the given mapping function
1638       * and enters it into this map unless {@code null}.  The entire
# Line 4691 | Line 4710 | public class ConcurrentHashMap<K,V> exte
4710              throw new UnsupportedOperationException();
4711          }
4712  
4713 +        public boolean removeIf(Predicate<? super V> filter) {
4714 +            return map.removeValueIf(filter);
4715 +        }
4716 +
4717          public Spliterator<V> spliterator() {
4718              Node<K,V>[] t;
4719              ConcurrentHashMap<K,V> m = map;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines