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 |
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; |