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

Comparing jsr166/src/main/java/util/concurrent/ConcurrentSkipListMap.java (file contents):
Revision 1.143 by dl, Tue Apr 28 23:06:53 2015 UTC vs.
Revision 1.144 by dl, Wed Apr 29 10:42:15 2015 UTC

# Line 2458 | Line 2458 | public class ConcurrentSkipListMap<K,V>
2458              else
2459                  return (Spliterator<E>)((SubMap<?,E>)m).valueIterator();
2460          }
2461 +        public boolean removeIf(Predicate<? super E> filter) {
2462 +            return ((ConcurrentSkipListMap<?,E>)m).removeValueIf(filter);
2463 +        }
2464      }
2465  
2466      static final class EntrySet<K1,V1> extends AbstractSet<Map.Entry<K1,V1>> {
# Line 3250 | Line 3253 | public class ConcurrentSkipListMap<K,V>
3253                      removed = true;
3254              }
3255          }
3256 +        return removed;
3257 +    }
3258 +
3259 +    /**
3260 +     * Helper method for Values.removeIf
3261 +     */
3262 +    boolean removeValueIf(Predicate<? super V> function) {
3263 +        if (function == null) throw new NullPointerException();
3264 +        boolean removed = false;
3265 +        for (Node<K,V> n = findFirst(); n != null; n = n.next) {
3266 +            V v;
3267 +            if ((v = n.getValidValue()) != null) {
3268 +                K k = n.key;
3269 +                if (function.test(v) && remove(k, v))
3270 +                    removed = true;
3271 +            }
3272 +        }
3273          return removed;
3274      }
3275  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines