org.directwebremoting.util
Class CompareUtil

java.lang.Object
  extended by org.directwebremoting.util.CompareUtil

public class CompareUtil
extends java.lang.Object

Some utilities for comparing objects that could be null

Author:
Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
CompareUtil()
           
 
Method Summary
static
<T> int
compare(java.lang.Comparable<T> o1, T o2)
          Compare 2 objects taking account of the fact that either could be null
static boolean equals(java.lang.Object o1, java.lang.Object o2)
          Compare 2 objects taking account of the fact that either could be null
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CompareUtil

public CompareUtil()
Method Detail

compare

public static <T> int compare(java.lang.Comparable<T> o1,
                              T o2)
Compare 2 objects taking account of the fact that either could be null

Type Parameters:
T - The type that we are comparing
Parameters:
o1 - The first object to compare
o2 - The second object to compare
Returns:
-1, 0, or 1

equals

public static boolean equals(java.lang.Object o1,
                             java.lang.Object o2)
Compare 2 objects taking account of the fact that either could be null

Parameters:
o1 - The first object to compare
o2 - The second object to compare
Returns:
true iff they are both null or if o1.equals(o2)

Copyright 2008