< prev index next >
src/java.base/share/classes/java/util/Map.java
Print this page
@@ -139,11 +139,11 @@
* <a href="{@docRoot}/serialized-form.html#java.util.CollSer">Serialized Form</a>
* page.
* </ul>
*
* <p>This interface is a member of the
- * <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
+ * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
* Java Collections Framework</a>.
*
* @param <K> the type of keys maintained by this map
* @param <V> the type of mapped values
*
@@ -185,14 +185,14 @@
* @param key key whose presence in this map is to be tested
* @return {@code true} if this map contains a mapping for the specified
* key
* @throws ClassCastException if the key is of an inappropriate type for
* this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not permit null keys
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean containsKey(Object key);
/**
* Returns {@code true} if this map maps one or more keys to the
@@ -205,14 +205,14 @@
* @param value value whose presence in this map is to be tested
* @return {@code true} if this map maps one or more keys to the
* specified value
* @throws ClassCastException if the value is of an inappropriate type for
* this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified value is null and this
* map does not permit null values
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
*/
boolean containsValue(Object value);
/**
* Returns the value to which the specified key is mapped,
@@ -233,14 +233,14 @@
* @param key the key whose associated value is to be returned
* @return the value to which the specified key is mapped, or
* {@code null} if this map contains no mapping for the key
* @throws ClassCastException if the key is of an inappropriate type for
* this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not permit null keys
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
*/
V get(Object key);
// Modification Operations
@@ -293,14 +293,14 @@
* {@code null} if there was no mapping for {@code key}.
* @throws UnsupportedOperationException if the {@code remove} operation
* is not supported by this map
* @throws ClassCastException if the key is of an inappropriate type for
* this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this
* map does not permit null keys
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
*/
V remove(Object key);
// Bulk Operations
@@ -606,14 +606,14 @@
* @param defaultValue the default mapping of the key
* @return the value to which the specified key is mapped, or
* {@code defaultValue} if this map contains no mapping for the key
* @throws ClassCastException if the key is of an inappropriate type for
* this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not permit null keys
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default V getOrDefault(Object key, V defaultValue) {
V v;
return (((v = get(key)) != null) || containsKey(key))
@@ -688,17 +688,17 @@
* @throws NullPointerException if the specified function is null, or the
* specified replacement value is null, and this map does not permit null
* values
* @throws ClassCastException if a replacement value is of an inappropriate
* type for this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if function or a replacement value is null,
* and this map does not permit null keys or values
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of a replacement value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ConcurrentModificationException if an entry is found to be
* removed during iteration
* @since 1.8
*/
default void replaceAll(BiFunction<? super K, ? super V, ? extends V> function) {
@@ -755,20 +755,20 @@
* (A {@code null} return can also indicate that the map
* previously associated {@code null} with the key,
* if the implementation supports null values.)
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the key or value is of an inappropriate
* type for this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key or value is null,
* and this map does not permit null keys or values
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default V putIfAbsent(K key, V value) {
V v = get(key);
if (v == null) {
@@ -801,17 +801,17 @@
* @param key key with which the specified value is associated
* @param value value expected to be associated with the specified key
* @return {@code true} if the value was removed
* @throws UnsupportedOperationException if the {@code remove} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the key or value is of an inappropriate
* type for this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key or value is null,
* and this map does not permit null keys or values
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default boolean remove(Object key, Object value) {
Object curValue = get(key);
if (!Objects.equals(curValue, value) ||
@@ -850,18 +850,18 @@
* @param oldValue value expected to be associated with the specified key
* @param newValue value to be associated with the specified key
* @return {@code true} if the value was replaced
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of a specified key or value
* prevents it from being stored in this map
* @throws NullPointerException if a specified key or newValue is null,
* and this map does not permit null keys or values
* @throws NullPointerException if oldValue is null and this map does not
* permit null values
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of a specified key
* or value prevents it from being stored in this map
* @since 1.8
*/
default boolean replace(K key, V oldValue, V newValue) {
@@ -900,14 +900,14 @@
* (A {@code null} return can also indicate that the map
* previously associated {@code null} with the key,
* if the implementation supports null values.)
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key or value is null,
* and this map does not permit null keys or values
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
* @since 1.8
@@ -983,17 +983,17 @@
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the mappingFunction
* is null
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default V computeIfAbsent(K key,
Function<? super K, ? extends V> mappingFunction) {
Objects.requireNonNull(mappingFunction);
@@ -1060,17 +1060,17 @@
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
* remappingFunction is null
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default V computeIfPresent(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1152,17 +1152,17 @@
* @throws NullPointerException if the specified key is null and
* this map does not support null keys, or the
* remappingFunction is null
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @since 1.8
*/
default V compute(K key,
BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
Objects.requireNonNull(remappingFunction);
@@ -1247,17 +1247,17 @@
* present
* @return the new value associated with the specified key, or null if no
* value is associated with the key
* @throws UnsupportedOperationException if the {@code put} operation
* is not supported by this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws ClassCastException if the class of the specified key or value
* prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws IllegalArgumentException if some property of the specified key
* or value prevents it from being stored in this map
- * (<a href="{@docRoot}/java/util/Collection.html#optional-restrictions">optional</a>)
+ * (<a href="{@docRoot}/java.base/java/util/Collection.html#optional-restrictions">optional</a>)
* @throws NullPointerException if the specified key is null and this map
* does not support null keys or the value or remappingFunction is
* null
* @since 1.8
*/
< prev index next >