RFR (2nd round) 8009736: Comparator API cleanup

Michael Hixson michael.hixson at gmail.com
Thu Jun 20 22:45:10 UTC 2013


+ return new NullComparator(nullFirst, real == null ? null :
real.thenComparing(other));

Should that be "other" instead of the second "null", like this?

+ return new NullComparator(nullFirst, real == null ? other :
real.thenComparing(other));

Also, if Comparator.nullsFirst(null) and nullsLast(null) no longer
throw, I think it's worth mentioning what their behavior is in the
javadocs.  My suggestion:

"If the specified comparator is {@code null}, then the returned
comparator considers all non-null values to be equal."

-Michael

On Thu, Jun 20, 2013 at 3:36 PM, Henry Jen <henry.jen at oracle.com> wrote:
> On 06/20/2013 09:50 AM, Ivan Gerasimov wrote:
>>>Returns a comparator compares {@link Comparable} type in natural order.
>>
>> Shouldn't be "Returns a comparator that compares"?
>>
>
> Fixed, I updated the webrev with this and a minor update for NullComparator.
>
> The difference from previous webrev is in following changeset,
>
> http://hg.openjdk.java.net/lambda/lambda/jdk/rev/0ca783c9c628
>
> Cheers,
> Henry
>



More information about the core-libs-dev mailing list