RichFaces CDK Generator 4.2.0.CR1

org.richfaces.cdk.util
Class ComparatorUtils

java.lang.Object
  extended by org.richfaces.cdk.util.ComparatorUtils

public final class ComparatorUtils
extends Object

Helper methods for comparable types

Author:
Nick Belaevski

Method Summary
static
<T extends Comparable<T>>
int
nullSafeCompare(T t1, T t2)
           Does null-safe comparison of mutually comparable objects.
static
<T> boolean
nullSafeEquals(T t1, T t2)
          

Null-safe equals check.

 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

nullSafeCompare

public static <T extends Comparable<T>> int nullSafeCompare(T t1,
                                                            T t2)

Does null-safe comparison of mutually comparable objects.

Obeys common rules of Comparable.compareTo(Object) methods if both objects to compare are non-null.

If one of the objects is null, but the other is not, then null object is considered to be less than non-null.

Two null objects are considered as equal.

Type Parameters:
T - the type of objects that this object may be compared to
Parameters:
t1 - the first object
t2 - the second object
Returns:

nullSafeEquals

public static <T> boolean nullSafeEquals(T t1,
                                         T t2)

Null-safe equals check. Return true if both arguments are null or equal.

Type Parameters:
T - the type of objects to compare.
Parameters:
t1 -
t2 -
Returns:
true if both arguments are null or equal

RichFaces CDK Generator 4.2.0.CR1

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.