protected void checkBoundaryCompatibility(){
  if (from instanceof String && to instanceof String) {
    final String start=from.toString();
    final String end=to.toString();
    if (start.length() != end.length()) {
      throw new IllegalArgumentException("Incompatible Strings for Range: different length");
    }
    final int length=start.length();
    int i;
    for (i=0; i < length; i++) {
      if (start.charAt(i) != end.charAt(i)) {
        break;
      }
    }
    if (i < length - 1) {
      throw new IllegalArgumentException("Incompatible Strings for Range: String#next() will not reach the expected value");
    }
  }
}

protected void checkBoundaryCompatibility ( ) { if ( from instanceof String && to instanceof String ) { final String start = from . toString ( ) ; final String end = to . toString ( ) ; if ( start . length ( ) != end . length ( ) ) { throw new IllegalArgumentException ( "Incompatible Strings for Range: different length" ) ; } final int length = start . length ( ) ; int i ; for ( i = 0 ; i < length ; i ++ ) { if ( start . charAt ( i ) != end . charAt ( i ) ) { break ; } } if ( i < length - 1 ) { throw new IllegalArgumentException ( "Incompatible Strings for Range: String#next() will not reach the expected value" ) ; } } }
throws illegalargumentexception if to and from are incompatible , meaning they e . g . ( likely ) produce infinite sequences . called at construction time , subclasses may override cautiously ( using only members to and from ) .
