private static Comparable<?> castToComparable(Object obj){
  try {
    return (Comparable<?>)obj;
  }
 catch (  ClassCastException cce) {
    throw new IllegalArgumentException("Type " + obj.getClass() + " doesn't implement Comparable, Serialization mode might be different than "+ StorageType.OBJECT+ ".",cce);
  }
}

private static Comparable < ? > castToComparable ( Object obj ) { try { return ( Comparable < ? > ) obj ; } catch ( ClassCastException cce ) { throw new IllegalArgumentException ( "Type " + obj . getClass ( ) + " doesn't implement Comparable, Serialization mode might be different than " + StorageType . OBJECT + "." , cce ) ; } }
cast the object to comparable otherwise throws an illegalargumentexception exception
