RFR: 8343125: Correct the documentation for TreeMap's getFloorEntry and getCeilingEntry
Chen Liang
liach at openjdk.org
Wed Nov 13 17:00:58 UTC 2024
On Sat, 26 Oct 2024 14:06:37 GMT, Naman Nigam <duke at openjdk.org> wrote:
> As the documentation of getCeilingEntry currently reads, the inference is misleading as follows:
>
> if no such entry exists, returns the entry for the least key greater than the specified key;
> if no such entry exists (i.e., the greatest key in the Tree is less than the specified key), returns {@code null}
> Have modified the first section to ensure that its clear that the value returned is upon existence of the key. Added a similar change for getFloorEntry.
To get a JBS issue, please open a bug report about this typo in https://bugs.java.com/bugdatabase/. Also follow https://openjdk.org/guide for the rest of the steps for contributions.
src/java.base/share/classes/java/util/TreeMap.java line 424:
> 422: /**
> 423: * Gets the entry corresponding to the specified key; returns the entry for
> 424: * the least key greater than the specified key; if no such entry exists
What about: (same for the floor one)
Returns the entry for the least key greater than or equal to the specified key;
if no such entry exists (i.e. the specified key is greater than any key in the tree),
returns {@code null}.
What do you think of my version?
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21729#issuecomment-2439810022
PR Review Comment: https://git.openjdk.org/jdk/pull/21729#discussion_r1819302174
More information about the core-libs-dev
mailing list