Interesting - couldn't you promote this fix as a minor performance
improvement as well to knock out would would be a pointless instanceof
in the case of ""?

public boolean contentEquals(CharSequence cs) {

  if (cs == null) {
        throw new NPE;
  }

  if (cs.length() != count) {
        return false;
  }

  if (cs.length() == 0 && count == 0) {
        return true;  // since both are empty strings
  }

  if (cs instanceof StringBuffer) {
        return contentEquals(...);
  }
  else {
    return regionMatches(...);
  }
}


Nathan Beyer wrote:
> http://issues.apache.org/jira/browse/HARMONY-719
> 
>  
> 
> This issue identifies a valid bug in java.lang.String and good patch to fix
> it. Does anyone have any objections to applying this patch or any comments?
> 
>  
> 
> -Nathan
> 
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to