5 |
|
*/ |
6 |
|
|
7 |
|
package java.util.concurrent; |
8 |
+ |
|
9 |
|
import java.util.Map; |
10 |
|
|
11 |
|
/** |
12 |
|
* A {@link java.util.Map} providing additional atomic |
13 |
< |
* <tt>putIfAbsent</tt>, <tt>remove</tt>, and <tt>replace</tt> methods. |
13 |
> |
* {@code putIfAbsent}, {@code remove}, and {@code replace} methods. |
14 |
|
* |
15 |
|
* <p>Memory consistency effects: As with other concurrent |
16 |
|
* collections, actions in a thread prior to placing an object into a |
28 |
|
* @param <K> the type of keys maintained by this map |
29 |
|
* @param <V> the type of mapped values |
30 |
|
*/ |
31 |
< |
public interface ConcurrentMap<K, V> extends Map<K, V> { |
31 |
> |
public interface ConcurrentMap<K,V> extends Map<K,V> { |
32 |
|
/** |
33 |
|
* If the specified key is not already associated |
34 |
|
* with a value, associate it with the given value. |
44 |
|
* @param key key with which the specified value is to be associated |
45 |
|
* @param value value to be associated with the specified key |
46 |
|
* @return the previous value associated with the specified key, or |
47 |
< |
* <tt>null</tt> if there was no mapping for the key. |
48 |
< |
* (A <tt>null</tt> return can also indicate that the map |
49 |
< |
* previously associated <tt>null</tt> with the key, |
47 |
> |
* {@code null} if there was no mapping for the key. |
48 |
> |
* (A {@code null} return can also indicate that the map |
49 |
> |
* previously associated {@code null} with the key, |
50 |
|
* if the implementation supports null values.) |
51 |
< |
* @throws UnsupportedOperationException if the <tt>put</tt> operation |
51 |
> |
* @throws UnsupportedOperationException if the {@code put} operation |
52 |
|
* is not supported by this map |
53 |
|
* @throws ClassCastException if the class of the specified key or value |
54 |
|
* prevents it from being stored in this map |
73 |
|
* |
74 |
|
* @param key key with which the specified value is associated |
75 |
|
* @param value value expected to be associated with the specified key |
76 |
< |
* @return <tt>true</tt> if the value was removed |
77 |
< |
* @throws UnsupportedOperationException if the <tt>remove</tt> operation |
76 |
> |
* @return {@code true} if the value was removed |
77 |
> |
* @throws UnsupportedOperationException if the {@code remove} operation |
78 |
|
* is not supported by this map |
79 |
|
* @throws ClassCastException if the key or value is of an inappropriate |
80 |
|
* type for this map |
100 |
|
* @param key key with which the specified value is associated |
101 |
|
* @param oldValue value expected to be associated with the specified key |
102 |
|
* @param newValue value to be associated with the specified key |
103 |
< |
* @return <tt>true</tt> if the value was replaced |
104 |
< |
* @throws UnsupportedOperationException if the <tt>put</tt> operation |
103 |
> |
* @return {@code true} if the value was replaced |
104 |
> |
* @throws UnsupportedOperationException if the {@code put} operation |
105 |
|
* is not supported by this map |
106 |
|
* @throws ClassCastException if the class of a specified key or value |
107 |
|
* prevents it from being stored in this map |
126 |
|
* @param key key with which the specified value is associated |
127 |
|
* @param value value to be associated with the specified key |
128 |
|
* @return the previous value associated with the specified key, or |
129 |
< |
* <tt>null</tt> if there was no mapping for the key. |
130 |
< |
* (A <tt>null</tt> return can also indicate that the map |
131 |
< |
* previously associated <tt>null</tt> with the key, |
129 |
> |
* {@code null} if there was no mapping for the key. |
130 |
> |
* (A {@code null} return can also indicate that the map |
131 |
> |
* previously associated {@code null} with the key, |
132 |
|
* if the implementation supports null values.) |
133 |
< |
* @throws UnsupportedOperationException if the <tt>put</tt> operation |
133 |
> |
* @throws UnsupportedOperationException if the {@code put} operation |
134 |
|
* is not supported by this map |
135 |
|
* @throws ClassCastException if the class of the specified key or value |
136 |
|
* prevents it from being stored in this map |