diff -r 67aa4920495c -r aa5490a167ee jdk/src/java.base/share/classes/java/util/HashMap.java --- a/jdk/src/java.base/share/classes/java/util/HashMap.java Tue Aug 11 08:48:18 2015 -0400 +++ b/jdk/src/java.base/share/classes/java/util/HashMap.java Tue Aug 11 20:46:46 2015 +0300 @@ -36,24 +36,24 @@ import java.util.function.Function; /** - * Hash table based implementation of the Map interface. This + * Hash table based implementation of the {@code Map} interface. This * implementation provides all of the optional map operations, and permits - * null values and the null key. (The HashMap - * class is roughly equivalent to Hashtable, except that it is + * {@code null} values and the {@code null} key. (The {@code HashMap} + * class is roughly equivalent to {@code Hashtable}, except that it is * unsynchronized and permits nulls.) This class makes no guarantees as to * the order of the map; in particular, it does not guarantee that the order * will remain constant over time. * *

This implementation provides constant-time performance for the basic - * operations (get and put), assuming the hash function + * operations ({@code get} and {@code put}), assuming the hash function * disperses the elements properly among the buckets. Iteration over * collection views requires time proportional to the "capacity" of the - * HashMap instance (the number of buckets) plus its size (the number + * {@code HashMap} instance (the number of buckets) plus its size (the number * of key-value mappings). Thus, it's very important not to set the initial * capacity too high (or the load factor too low) if iteration performance is * important. * - *

An instance of HashMap has two parameters that affect its + *

An instance of {@code HashMap} has two parameters that affect its * performance: initial capacity and load factor. The * capacity is the number of buckets in the hash table, and the initial * capacity is simply the capacity at the time the hash table is created. The @@ -67,15 +67,15 @@ *

As a general rule, the default load factor (.75) offers a good * tradeoff between time and space costs. Higher values decrease the * space overhead but increase the lookup cost (reflected in most of - * the operations of the HashMap class, including - * get and put). The expected number of entries in + * the operations of the {@code HashMap} class, including + * {@code get} and {@code put}). The expected number of entries in * the map and its load factor should be taken into account when * setting its initial capacity, so as to minimize the number of * rehash operations. If the initial capacity is greater than the * maximum number of entries divided by the load factor, no rehash * operations will ever occur. * - *

If many mappings are to be stored in a HashMap + *

If many mappings are to be stored in a {@code HashMap} * instance, creating it with a sufficiently large capacity will allow * the mappings to be stored more efficiently than letting it perform * automatic rehashing as needed to grow the table. Note that using @@ -102,7 +102,7 @@ *

The iterators returned by all of this class's "collection view methods" * are fail-fast: if the map is structurally modified at any time after * the iterator is created, in any way except through the iterator's own - * remove method, the iterator will throw a + * {@code remove} method, the iterator will throw a * {@link ConcurrentModificationException}. Thus, in the face of concurrent * modification, the iterator fails quickly and cleanly, rather than risking * arbitrary, non-deterministic behavior at an undetermined time in the @@ -111,7 +111,7 @@ *

Note that the fail-fast behavior of an iterator cannot be guaranteed * as it is, generally speaking, impossible to make any hard guarantees in the * presence of unsynchronized concurrent modification. Fail-fast iterators - * throw ConcurrentModificationException on a best-effort basis. + * throw {@code ConcurrentModificationException} on a best-effort basis. * Therefore, it would be wrong to write a program that depended on this * exception for its correctness: the fail-fast behavior of iterators * should be used only to detect bugs. @@ -435,7 +435,7 @@ /* ---------------- Public operations -------------- */ /** - * Constructs an empty HashMap with the specified initial + * Constructs an empty {@code HashMap} with the specified initial * capacity and load factor. * * @param initialCapacity the initial capacity @@ -457,7 +457,7 @@ } /** - * Constructs an empty HashMap with the specified initial + * Constructs an empty {@code HashMap} with the specified initial * capacity and the default load factor (0.75). * * @param initialCapacity the initial capacity. @@ -468,7 +468,7 @@ } /** - * Constructs an empty HashMap with the default initial capacity + * Constructs an empty {@code HashMap} with the default initial capacity * (16) and the default load factor (0.75). */ public HashMap() { @@ -476,10 +476,10 @@ } /** - * Constructs a new HashMap with the same mappings as the - * specified Map. The HashMap is created with + * Constructs a new {@code HashMap} with the same mappings as the + * specified {@code Map}. The {@code HashMap} is created with * default load factor (0.75) and an initial capacity sufficient to - * hold the mappings in the specified Map. + * hold the mappings in the specified {@code Map}. * * @param m the map whose mappings are to be placed in this map * @throws NullPointerException if the specified map is null @@ -526,9 +526,9 @@ } /** - * Returns true if this map contains no key-value mappings. + * Returns {@code true} if this map contains no key-value mappings. * - * @return true if this map contains no key-value mappings + * @return {@code true} if this map contains no key-value mappings */ public boolean isEmpty() { return size == 0; @@ -584,11 +584,11 @@ } /** - * Returns true if this map contains a mapping for the + * Returns {@code true} if this map contains a mapping for the * specified key. * * @param key The key whose presence in this map is to be tested - * @return true if this map contains a mapping for the specified + * @return {@code true} if this map contains a mapping for the specified * key. */ public boolean containsKey(Object key) { @@ -602,10 +602,10 @@ * * @param key key with which the specified value is to be associated * @param value value to be associated with the specified key - * @return the previous value associated with key, or - * null if there was no mapping for key. - * (A null return can also indicate that the map - * previously associated null with key.) + * @return the previous value associated with {@code key}, or + * {@code null} if there was no mapping for {@code key}. + * (A {@code null} return can also indicate that the map + * previously associated {@code null} with {@code key}.) */ public V put(K key, V value) { return putVal(hash(key), key, value, false, true); @@ -788,10 +788,10 @@ * Removes the mapping for the specified key from this map if present. * * @param key key whose mapping is to be removed from the map - * @return the previous value associated with key, or - * null if there was no mapping for key. - * (A null return can also indicate that the map - * previously associated null with key.) + * @return the previous value associated with {@code key}, or + * {@code null} if there was no mapping for {@code key}. + * (A {@code null} return can also indicate that the map + * previously associated {@code null} with {@code key}.) */ public V remove(Object key) { Node e; @@ -865,11 +865,11 @@ } /** - * Returns true if this map maps one or more keys to the + * Returns {@code true} if this map maps one or more keys to the * specified value. * * @param value value whose presence in this map is to be tested - * @return true if this map maps one or more keys to the + * @return {@code true} if this map maps one or more keys to the * specified value */ public boolean containsValue(Object value) { @@ -891,12 +891,12 @@ * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through - * the iterator's own remove operation), the results of + * the iterator's own {@code remove} operation), the results of * the iteration are undefined. The set supports element removal, * which removes the corresponding mapping from the map, via the - * Iterator.remove, Set.remove, - * removeAll, retainAll, and clear - * operations. It does not support the add or addAll + * {@code Iterator.remove}, {@code Set.remove}, + * {@code removeAll}, {@code retainAll}, and {@code clear} + * operations. It does not support the {@code add} or {@code addAll} * operations. * * @return a set view of the keys contained in this map @@ -938,13 +938,13 @@ * The collection is backed by the map, so changes to the map are * reflected in the collection, and vice-versa. If the map is * modified while an iteration over the collection is in progress - * (except through the iterator's own remove operation), + * (except through the iterator's own {@code remove} operation), * the results of the iteration are undefined. The collection * supports element removal, which removes the corresponding - * mapping from the map, via the Iterator.remove, - * Collection.remove, removeAll, - * retainAll and clear operations. It does not - * support the add or addAll operations. + * mapping from the map, via the {@code Iterator.remove}, + * {@code Collection.remove}, {@code removeAll}, + * {@code retainAll} and {@code clear} operations. It does not + * support the {@code add} or {@code addAll} operations. * * @return a view of the values contained in this map */ @@ -982,14 +982,14 @@ * The set is backed by the map, so changes to the map are * reflected in the set, and vice-versa. If the map is modified * while an iteration over the set is in progress (except through - * the iterator's own remove operation, or through the - * setValue operation on a map entry returned by the + * the iterator's own {@code remove} operation, or through the + * {@code setValue} operation on a map entry returned by the * iterator) the results of the iteration are undefined. The set * supports element removal, which removes the corresponding - * mapping from the map, via the Iterator.remove, - * Set.remove, removeAll, retainAll and - * clear operations. It does not support the - * add or addAll operations. + * mapping from the map, via the {@code Iterator.remove}, + * {@code Set.remove}, {@code removeAll}, {@code retainAll} and + * {@code clear} operations. It does not support the + * {@code add} or {@code addAll} operations. * * @return a set view of the mappings contained in this map */ @@ -1357,7 +1357,7 @@ // Cloning and serialization /** - * Returns a shallow copy of this HashMap instance: the keys and + * Returns a shallow copy of this {@code HashMap} instance: the keys and * values themselves are not cloned. * * @return a shallow copy of this map @@ -1386,7 +1386,7 @@ } /** - * Save the state of the HashMap instance to a stream (i.e., + * Save the state of the {@code HashMap} instance to a stream (i.e., * serialize it). * * @serialData The capacity of the HashMap (the length of the