| java.lang.Object org.springframework.util.comparator.NullSafeComparator
NullSafeComparator | public class NullSafeComparator implements Comparator(Code) | | A Comparator that will safely compare nulls to be lower or higher than
other objects. Can decorate a given Comparator or work on Comparables.
author: Keith Donald author: Juergen Hoeller since: 1.2.2 See Also: Comparable |
Field Summary | |
final public static NullSafeComparator | NULLS_HIGH A shared default instance of this comparator, treating nulls higher
than non-null objects. | final public static NullSafeComparator | NULLS_LOW A shared default instance of this comparator, treating nulls lower
than non-null objects. |
Constructor Summary | |
public | NullSafeComparator(Comparator comparator, boolean nullsLow) Create a NullSafeComparator that sorts null based on the
provided flag, decorating the given Comparator. |
NULLS_HIGH | final public static NullSafeComparator NULLS_HIGH(Code) | | A shared default instance of this comparator, treating nulls higher
than non-null objects.
|
NULLS_LOW | final public static NullSafeComparator NULLS_LOW(Code) | | A shared default instance of this comparator, treating nulls lower
than non-null objects.
|
NullSafeComparator | public NullSafeComparator(Comparator comparator, boolean nullsLow)(Code) | | Create a NullSafeComparator that sorts null based on the
provided flag, decorating the given Comparator.
When comparing two non-null objects, the specified Comparator will be used.
The given underlying Comparator must be able to handle the elements that this
Comparator will be applied to.
Parameters: comparator - the comparator to use when comparing two non-null objects Parameters: nullsLow - whether to treat nulls lower or higher than non-null objects |
hashCode | public int hashCode()(Code) | | |
|
|