java.lang.Object | +--org.apache.commons.collections.comparators.NullComparatorAll Implemented Interfaces:
Construct an instance that sorts null higher than any non-null object it is compared with. |
NullComparator(Comparator nonNullComparator) Construct an instance that sorts null higher than any non-null object it is compared with. |
NullComparator(boolean nullsAreHigh) Construct an instance that sorts null higher or lower than any non-null object it is compared with. |
NullComparator(Comparator nonNullComparator, boolean nullsAreHigh) Construct an instance that sorts null higher or lower than any non-null object it is compared with. |
int | compare(Object o1, Object o2) Perform a comparison between two objects. |
boolean | equals(Object obj) Determines whether the specified object represents a comparator that is equal to this comparator. |
int | hashCode() Implement a hash code for this comparator that is consistent with #equals(Object). |
public NullComparator()
null
higher than any
non-null
object it is compared with. When comparing two
non-null
objects, the ComparableComparator is
used.
public NullComparator(boolean nullsAreHigh)
null
higher or lower than
any non-null
object it is compared with. When comparing
two non-null
objects, the ComparableComparator is
used.
public NullComparator(Comparator nonNullComparator, boolean nullsAreHigh)
null
higher or lower than
any non-null
object it is compared with. When comparing
two non-null
objects, the specified Comparator is
used.
- if nonNullComparator is
nullpublic NullComparator(Comparator nonNullComparator)
null
higher than any
non-null
object it is compared with. When comparing two
non-null
objects, the specified Comparator is
used.
- if nonNullComparator is
nullpublic int compare(Object o1, Object o2)
null
, a 0
value is returned. If one object
is null
and the other is not, the result is determined on
whether the Comparator was constructed to have nulls as higher or lower
than other objects. If neither object is null
, an
underlying comparator specified in the constructor (or the default) is
used to compare the non-null
objects.
public boolean equals(Object obj)
public int hashCode()