protected static int compareValues(Object valueOne,Object valueTwo,boolean isDescending){
  if (valueOne == null || valueTwo == null) {
    if (valueOne == null && valueTwo == null) {
      return 0;
    }
    if (valueOne == null) {
      if (isDescending) {
        return 1;
      }
      return -1;
    }
    if (isDescending) {
      return -1;
    }
    return 1;
  }
  Comparable comparable1;
  if (valueOne instanceof Comparable) {
    comparable1=(Comparable)valueOne;
  }
 else {
    throw new ClassCastException("Cannot sort objects of type " + valueOne.getClass());
  }
  if (isDescending) {
    return -1 * comparable1.compareTo(valueTwo);
  }
  return comparable1.compareTo(valueTwo);
}

protected static int compareValues ( Object valueOne , Object valueTwo , boolean isDescending ) { if ( valueOne == null || valueTwo == null ) { if ( valueOne == null && valueTwo == null ) { return 0 ; } if ( valueOne == null ) { if ( isDescending ) { return 1 ; } return - 1 ; } if ( isDescending ) { return - 1 ; } return 1 ; } Comparable comparable1 ; if ( valueOne instanceof Comparable ) { comparable1 = ( Comparable ) valueOne ; } else { throw new ClassCastException ( "Cannot sort objects of type " + valueOne . getClass ( ) ) ; } if ( isDescending ) { return - 1 * comparable1 . compareTo ( valueTwo ) ; } return comparable1 . compareTo ( valueTwo ) ; }
compares two nullable values .
