net.mtu.eggplant.util
Class ComparisonUtils

java.lang.Object
  extended by net.mtu.eggplant.util.ComparisonUtils

public final class ComparisonUtils
extends Object

Handy comparision routines.

Version:
$Revision$

Method Summary
static int compareBooleans(boolean one, boolean two)
          true is always greater than false.
static int compareDoubles(double one, double two)
          Compare two doubles.
static int compareFloats(float one, float two)
          Compare two floats.
static int compareIntegers(long one, long two)
          Compare two non-floating point numbers.
static int compareStrings(String one, String two)
          Compare two Strings, null is allowed and is greater than every non-null String.
static boolean safeEquals(Object o1, Object o2)
          Equals call that handles null without a NullPointerException.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

compareBooleans

public static int compareBooleans(boolean one,
                                  boolean two)
true is always greater than false.


compareIntegers

public static int compareIntegers(long one,
                                  long two)
Compare two non-floating point numbers.


compareDoubles

public static int compareDoubles(double one,
                                 double two)
Compare two doubles. Comparisions exist for double and float because casting a float to a double and vice versa can cause loss of precision.


compareFloats

public static int compareFloats(float one,
                                float two)
Compare two floats. Comparisions exist for double and float because casting a float to a double and vice versa can cause loss of precision.


compareStrings

public static int compareStrings(String one,
                                 String two)
Compare two Strings, null is allowed and is greater than every non-null String.


safeEquals

public static boolean safeEquals(Object o1,
                                 Object o2)
Equals call that handles null without a NullPointerException.