On Tue, 13 Oct 2020 15:23:35 GMT, Jonathan Gibbons <j...@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

Reply via email to