Package com.opencloud.util
Class CompareUtil
- java.lang.Object
-
- com.opencloud.util.CompareUtil
-
public class CompareUtil extends Object
Utility class containing static comparison methods.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> intcompare(Comparable<T> c1, T c2)Compares two objects for relative order.static booleanequals(byte[] o1, byte[] o2)Compares two byte arrays for equality.static booleanequals(int[] o1, int[] o2)Compares two int arrays for equality.static booleanequals(Object[] o1, Object[] o2)Compares two arrays of objects for equality.static booleanequals(Object o1, Object o2)Compares two objects for equality.
-
-
-
Method Detail
-
equals
public static boolean equals(Object o1, Object o2)
Compares two objects for equality.- Parameters:
o1- Objecto2- Object- Returns:
- whether o1 and o2 are equal
-
equals
public static boolean equals(Object[] o1, Object[] o2)
Compares two arrays of objects for equality.- Parameters:
o1- Object arrayo2- Object array- Returns:
- whether o1 and o2 are equal
-
equals
public static boolean equals(byte[] o1, byte[] o2)Compares two byte arrays for equality.- Parameters:
o1- byte arrayo2- byte array- Returns:
- whether o1 and o2 are equal
-
equals
public static boolean equals(int[] o1, int[] o2)Compares two int arrays for equality.- Parameters:
o1- int arrayo2- int array- Returns:
- whether o1 and o2 are equal
-
compare
public static <T> int compare(Comparable<T> c1, T c2)
Compares two objects for relative order. Null values are ordered before (ie. considered smaller than) non-null values.- Type Parameters:
T- type of objects.- Parameters:
c1- Object that implementsComparablec2- Object- Returns:
- -1, 0, or 1 depending if
c1is less than, equal, or greater thanc2.
-
-