hg: lambda/lambda/jdk: 8009736: static Comparator methods and narrowing type support

Michael Hixson michael.hixson at gmail.com
Fri May 10 00:03:53 PDT 2013


Watch out for the (real == null) case in there.

  Comparator.nullsFirst().reverse(); // throws NPE

It could probably return one of the NULL_FIRST or NULL_LAST singletons
if you've decided that (real == null) means "this" is one of the
singletons.  If not, then new NullComparator(-sign, null).

-Michael

On Thu, May 9, 2013 at 11:48 PM, Henry Jen <henry.jen at oracle.com> wrote:
> On 05/09/2013 10:00 PM, Michael Hixson wrote:
>> Hi Henry,
>>
>> That's wonderful that null-friendly comparators are available now!
>> Maybe that happened earlier and I just missed it, but it's great.
>>
>> One minor detail - shouldn't NullComparator also override reverse()?
>> I bet reverse() would usually come at the end of the chain, but if it
>> didn't, I think you'd run into problems with this sequence of calls:
>>
>
> Thanks for the reporting, fixed.
>
> Cheers,
> Henry
>


More information about the lambda-dev mailing list