private static < T extends Comparable < T > > void ensureValidRange ( T min , T max ) { if ( min == null ) { throw new InvalidOperationException ( "Null value for minimum." ) ; } if ( max == null ) { throw new InvalidOperationException ( "Null value for maximum." ) ; } if ( min . compareTo ( max ) >= 0 ) { throw new InvalidOperationException ( "Invalid range: " + min + " >= " + max ) ; } }
Range validation utility method .