ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/main/java/util/concurrent/ConcurrentMap.java
Revision: 1.1
Committed: Wed May 14 21:30:45 2003 UTC (21 years, 1 month ago) by tim
Branch: MAIN
Log Message:
Moved main source rooted at . to ./src/main
Moved test source rooted at ./etc/testcases to ./src/test

File Contents

# Content
1 package java.util.concurrent;
2
3 import java.util.Map;
4
5 /**
6 * A ConcurrentMap is a Map providing an additional atomic
7 * <tt>putIfAbsent</tt> method.
8 **/
9 public interface ConcurrentMap<K, V> extends Map<K, V> {
10 /**
11 * If the specified key is not already associated
12 * with a value, associate it with the given value.
13 * This is equivalent to
14 * <pre>
15 * if (!map.containsKey(key)) map.put(key, value);
16 * return get(key);
17 * </pre>
18 * Except that the action is performed atomically.
19 * @param key key with which the specified value is to be associated.
20 * @param value value to be associated with the specified key.
21 * @return previous value associated with specified key, or <tt>null</tt>
22 * if there was no mapping for key. A <tt>null</tt> return can
23 * also indicate that the map previously associated <tt>null</tt>
24 * with the specified key, if the implementation supports
25 * <tt>null</tt> values.
26 *
27 * @throws UnsupportedOperationException if the <tt>put</tt> operation is
28 * not supported by this map.
29 * @throws ClassCastException if the class of the specified key or value
30 * prevents it from being stored in this map.
31 * @throws IllegalArgumentException if some aspect of this key or value
32 * prevents it from being stored in this map.
33 * @throws NullPointerException this map does not permit <tt>null</tt>
34 * keys or values, and the specified key or value is
35 * <tt>null</tt>.
36 *
37 **/
38 public V putIfAbsent(K key, V value);
39 }