RFR: JDK-8254627: Cleanup {Abstract, Single, Split}IndexWriter classes

Jonathan Gibbons jjg at openjdk.java.net
Tue Oct 13 15:27:22 UTC 2020


On Tue, 13 Oct 2020 15:23:35 GMT, Jonathan Gibbons <jjg at openjdk.org> wrote:

>> src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexWriter.java line 87:
>> 
>>> 85:         IndexBuilder mainIndex = configuration.mainIndex;
>>> 86:         List<Character> firstCharacters = mainIndex.getFirstCharacters();
>>> 87:         firstCharacters.sort(Comparator.naturalOrder());
>> 
>> Is this sorting step necessary? Aren't the characters returned by `IndexBuilder#getFirstCharacters()` already
>> guaranteed to be in natural order?
>
> Interesting ... while the contract is not enforced through the type system, the words of the spec do guarantee the
> ordering.

A related minor improvement that I will try out is to return an immutable set from `main Index.getFirstCharacters`

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

PR: https://git.openjdk.java.net/jdk/pull/621


More information about the javadoc-dev mailing list