Comparators.comparing doesn't handle nulls (original) (raw)
Henry Jen henry.jen at oracle.com
Thu Apr 18 15:50:37 PDT 2013
- Previous message: Comparators.comparing doesn't handle nulls
- Next message: Comparators.comparing doesn't handle nulls
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
Cheers, Henry
On Apr 18, 2013, at 1:28 PM, Michael Nascimento <misterm at gmail.com> 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
- Previous message: Comparators.comparing doesn't handle nulls
- Next message: Comparators.comparing doesn't handle nulls
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]