com.claritysys.util
Class Compare

java.lang.Object
  extended by com.claritysys.util.Compare

public final class Compare
extends java.lang.Object

A set of methods for comparing values.

Version:
$Revision: 2348 $

Constructor Summary
Compare()
           
 
Method Summary
static boolean areEqual(java.math.BigDecimal value1, java.math.BigDecimal value2)
          Return true if the two arguments are equal.
static boolean areEqual(boolean value1, boolean value2)
          Return true if the two arguments are equal.
static boolean areEqual(byte value1, byte value2)
          Return true if the two arguments are equal.
static boolean areEqual(char value1, char value2)
          Return true if the two arguments are equal.
static boolean areEqual(double value1, double value2)
          Return true if the two arguments are equal.
static boolean areEqual(float value1, float value2)
          Return true if the two arguments are equal.
static boolean areEqual(int value1, int value2)
          Return true if the two arguments are equal.
static boolean areEqual(long value1, long value2)
          Return true if the two arguments are equal.
static boolean areEqual(java.lang.Object value1, java.lang.Object value2)
          Return true if the two arguments are equal.
static boolean areEqual(short value1, short value2)
          Return true if the two arguments are equal.
static boolean areEqual(java.lang.String s1, java.lang.String s2)
          Return true if the two String arguments are equal, where either or both of the arguments may be null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compare

public Compare()
Method Detail

areEqual

public static boolean areEqual(boolean value1,
                               boolean value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(int value1,
                               int value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(long value1,
                               long value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(char value1,
                               char value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(byte value1,
                               byte value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(short value1,
                               short value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(float value1,
                               float value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(double value1,
                               double value2)
Return true if the two arguments are equal.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(java.lang.Object value1,
                               java.lang.Object value2)
Return true if the two arguments are equal.

Generic Object compare. If both are null returns true, else both must be of same class and value1.equals (value2) must return true.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.

areEqual

public static boolean areEqual(java.lang.String s1,
                               java.lang.String s2)
Return true if the two String arguments are equal, where either or both of the arguments may be null. If they are both null they are considered to be equal.

Parameters:
s1 - The first of the two Strings.
s2 - The second of the two Strings.
Returns:
true if s1 is null && s2 is null OR s1.equals (s2).

areEqual

public static boolean areEqual(java.math.BigDecimal value1,
                               java.math.BigDecimal value2)
Return true if the two arguments are equal.

Compare BigDecimal values using compareTo to ignore differences in scale.

Parameters:
value1 - The value to compare.
value2 - The value to compare against.
Returns:
True if value1 equals value2 else false.


Copyright ? 2002 Clarity Systems Group, LLC. All Rights Reserved.