public static <T> Comparator<T> nullsFirst (Comparator<? super T> comparator)

Returns a null-friendly comparator that considers null to be less than non-null. When both are null, they are considered equal. If both are non-null, the specified Comparator is used to determine the order. If the specified comparator is null, then the returned comparator considers all non-null values to be equal.

The returned comparator is serializable if the specified comparator is serializable.

Parameters:
<T>    the type of the elements to be compared
comparator    a Comparator for comparing non-null values

Returns:  a comparator that considers null to be less than non-null, and compares non-null objects with the supplied Comparator.

Since:  1.8