RFR: 8038146: Clarify NavigableMap/TreeMap support for Entry.setValue

Alan Bateman alanb at openjdk.org
Fri Jan 13 15:07:27 UTC 2023


On Thu, 12 Jan 2023 01:50:51 GMT, Stuart Marks <smarks at openjdk.org> wrote:

> Also additional verbiage regarding Map.Entry objects in general and their possible connection to an underlying Map.

src/java.base/share/classes/java/util/Map.java line 405:

> 403:      * {@link Iterator} or implicitly via the enhanced {@code for} statement. This connection
> 404:      * to the backing map is valid <i>only</i> during iteration of the entry-set view. During
> 405:      * the iteration, if supported by the backing map, a change to a Entry's value via

"a Entry's value" -> "an Entry's value" or "the value of an Entry" ?

src/java.base/share/classes/java/util/Map.java line 421:

> 419:      * {@link Set#toArray toArray} overloads,
> 420:      * or by copying the entry-set view into another collection. It is unspecified whether
> 421:      * the Entry instances thus obtained are connected to the underlying map, whether

It might be a bit clear if tweaked to "whether the obtained Entry instances are connected".

src/java.base/share/classes/java/util/NavigableMap.java line 80:

> 78:  * return {@link Map.Entry} instances that represent snapshots of mappings as
> 79:  * of the time of the call, and they do <em>not</em> support mutation of the
> 80:  * underlying map via the optional {@link Map.Entry#setValue setValue} method.

I think it would be a bit more readable to put to break after "as of the time of the call", either a full stop or "; they".  Same thing in TreeMap.

-------------

PR: https://git.openjdk.org/jdk/pull/11956


More information about the core-libs-dev mailing list