at.molindo.utils.data
Class ComparatorUtils

java.lang.Object
  extended by at.molindo.utils.data.ComparatorUtils

public class ComparatorUtils
extends Object


Field Summary
static Comparator<?> NULL_HIGH_COMPARABLE
          a comparator that compares Comparable objects using nullHighCompareTo(Comparable, Object)
static Comparator<?> NULL_LOW_COMPARABLE
          a comparator that compares Comparable objects using nullLowCompareTo(Comparable, Object)
 
Constructor Summary
ComparatorUtils()
           
 
Method Summary
static
<T> Comparator<T>
nullHighComparable()
           
static
<T> int
nullHighCompareTo(Comparable<T> o1, T o2)
          null-safe invocation of Comparable.compareTo(Object) placing null at the end of a sorted list (assuming each null is equal)
static
<T> Comparator<T>
nullLowComparable()
           
static
<T> int
nullLowCompareTo(Comparable<T> o1, T o2)
          null-safe invocation of Comparable.compareTo(Object) placing null at the beginning of a sorted list (assuming each null is equal)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_LOW_COMPARABLE

public static final Comparator<?> NULL_LOW_COMPARABLE
a comparator that compares Comparable objects using nullLowCompareTo(Comparable, Object)


NULL_HIGH_COMPARABLE

public static final Comparator<?> NULL_HIGH_COMPARABLE
a comparator that compares Comparable objects using nullHighCompareTo(Comparable, Object)

Constructor Detail

ComparatorUtils

public ComparatorUtils()
Method Detail

nullLowComparable

public static final <T> Comparator<T> nullLowComparable()
See Also:
NULL_LOW_COMPARABLE

nullHighComparable

public static final <T> Comparator<T> nullHighComparable()
See Also:
NULL_HIGH_COMPARABLE

nullLowCompareTo

public static <T> int nullLowCompareTo(Comparable<T> o1,
                                       T o2)
null-safe invocation of Comparable.compareTo(Object) placing null at the beginning of a sorted list (assuming each null is equal)

Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Assuming null is less than any object and equal to itself.
See Also:
Comparable.compareTo(Object)

nullHighCompareTo

public static <T> int nullHighCompareTo(Comparable<T> o1,
                                        T o2)
null-safe invocation of Comparable.compareTo(Object) placing null at the end of a sorted list (assuming each null is equal)

Returns:
a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second. Assuming null is greater than any object and equal to itself.
See Also:
Comparable.compareTo(Object)


Copyright © 2013 Molindo GmbH. All Rights Reserved.