org.databene.commons
Class NullSafeComparator<E>

java.lang.Object
  extended by org.databene.commons.NullSafeComparator<E>
All Implemented Interfaces:
java.util.Comparator<E>

public class NullSafeComparator<E>
extends java.lang.Object
implements java.util.Comparator<E>

Comparator Decorator that adds support for null-Value comparison. null may be defined to have a value either greater or less than any non-null value. Created: 11.04.2005 08:34:02


Field Summary
static int NULL_IS_GREATER
           
static int NULL_IS_LESSER
           
 
Constructor Summary
NullSafeComparator()
           
NullSafeComparator(java.util.Comparator<? super E> realComparator)
           
NullSafeComparator(java.util.Comparator<? super E> realComparator, int nullComparation)
           
NullSafeComparator(int nullComparation)
           
 
Method Summary
 int compare(E o1, E o2)
           
static
<T extends java.lang.Comparable<T>>
int
compare(T o1, T o2, int nullComparation)
           
static boolean equals(java.lang.Object o1, java.lang.Object o2)
           
static int hashCode(java.lang.Object o)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Field Detail

NULL_IS_LESSER

public static final int NULL_IS_LESSER
See Also:
Constant Field Values

NULL_IS_GREATER

public static final int NULL_IS_GREATER
See Also:
Constant Field Values
Constructor Detail

NullSafeComparator

public NullSafeComparator()

NullSafeComparator

public NullSafeComparator(int nullComparation)

NullSafeComparator

public NullSafeComparator(java.util.Comparator<? super E> realComparator)

NullSafeComparator

public NullSafeComparator(java.util.Comparator<? super E> realComparator,
                          int nullComparation)
Method Detail

compare

public int compare(E o1,
                   E o2)
Specified by:
compare in interface java.util.Comparator<E>

compare

public static <T extends java.lang.Comparable<T>> int compare(T o1,
                                                              T o2,
                                                              int nullComparation)

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)

hashCode

public static int hashCode(java.lang.Object o)


Copyright © 2010. All Rights Reserved.