On Fri, 14 Oct 2022 08:53:24 GMT, Сергей Цыпанов wrote:
>> We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance
>> is constructed without comparator. This allows to squash two branches in
>> `TreeMap.get()` into one.
>>
>> P.S. I think the comment of `TreeMap.getEntryUsin
On Thu, 13 Oct 2022 21:46:15 GMT, ExE Boss wrote:
>> Nope, there'd be a compilation error
>
> It'll work fine if an unchecked cast is used:
> Suggestion:
>
> @SuppressWarnings("unchecked")
> Comparator> entryComparator = treeComparator ==
> null ?
> (
> We can use `Comparator.naturalOrder()` for cases when a `TreeMap` instance is
> constructed without comparator. This allows to squash two branches in
> `TreeMap.get()` into one.
>
> P.S. I think the comment of `TreeMap.getEntryUsingComparator()` is outdated.
> Should we also change it?
Серге