Comparators.comparing doesn't handle nulls

Henry Jen henry.jen at
Thu Apr 18 15:50:37 PDT 2013

Would you be more specific?

Comparators.comparing is not taking null as arguments. As how the returned Comparator compare nulls is really depends on Comparator itself. The Comparable style comparator won't handle null as Comparable doesn't support null.


On Apr 18, 2013, at 1:28 PM, Michael Nascimento <misterm at> wrote:

> Hi guys,
> In most usages of Guava's ComparisonChain / Ordering that I am trying
> to replace with Comparator, nulls are involved. Comparators.comparing
> provides no easy way of handling this except by writing verbose code.
> Any plans to improve on that?
> Regards,
> Michael

More information about the lambda-dev mailing list