public static < T > int compareTo ( Comparable < T > object1 , T object2 ) { if ( object1 == object2 ) { return 0 ; } if ( object1 == null ) { return Integer . MIN_VALUE ; } if ( object2 == null ) { return Integer . MAX_VALUE ; } assert object1 != null && object2 != null ; return object1 . compareTo ( object2 ) ; }
Null - safe comparison .