Class RJavaComparator
- java.lang.Object
-
- RJavaComparator
-
public class RJavaComparator extends java.lang.Object
Utility class to compare two objects in the sense of the java.lang.Comparable interface
-
-
Constructor Summary
Constructors Constructor Description RJavaComparator()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
compare(java.lang.Object a, java.lang.Object b)
compares a and b in the sense of the java.lang.Comparable if possible
-
-
-
Method Detail
-
compare
public static int compare(java.lang.Object a, java.lang.Object b) throws NotComparableException
compares a and b in the sense of the java.lang.Comparable if possibleinstances of the Number interface are treated specially, in order to allow comparing Numbers of different classes, for example it is allowed to compare a Double with an Integer. if the Numbers have the same class, they are compared normally, otherwise they are first converted to Doubles and then compared
- Parameters:
a
- an objectb
- another object- Returns:
- the result of
a.compareTo(b)
if this makes sense - Throws:
NotComparableException
- if the two objects are not comparable
-
-