ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/jsr166e/ConcurrentHashMapV8.java
(Generate patch)

Comparing jsr166/src/jsr166e/ConcurrentHashMapV8.java (file contents):
Revision 1.61 by dl, Thu Sep 13 10:41:37 2012 UTC vs.
Revision 1.62 by dl, Fri Sep 21 18:41:30 2012 UTC

# Line 2494 | Line 2494 | public class ConcurrentHashMapV8<K, V>
2494      }
2495  
2496      /**
2497 +     * Returns the value to which the specified key is mapped,
2498 +     * or the gieven defaultValue if this map contains no mapping for the key.
2499 +     *
2500 +     * @param key the key
2501 +     * @param defaultValue the value to return if this map contains
2502 +     * no mapping for the given key.
2503 +     * @return the mapping for the key, if present; else the defaultValue
2504 +     * @throws NullPointerException if the specified key is null
2505 +     */
2506 +    @SuppressWarnings("unchecked") public V getValueOrDefault(Object key, V defaultValue) {
2507 +        if (key == null)
2508 +            throw new NullPointerException();
2509 +        V v = (V) internalGet(key);
2510 +        return v == null ? defaultValue : v;
2511 +    }
2512 +
2513 +    /**
2514       * Tests if the specified object is a key in this table.
2515       *
2516       * @param  key   possible key

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines