java.lang.String#contentEquals(CharSequence) suboptimal? (original) (raw)
Jesús Viñuales serverperformance at gmail.com
Mon Jan 4 17:20:48 UTC 2010
- Previous message: java.lang.String#contentEquals(CharSequence) suboptimal?
- Next message: hg: jdk7/tl/jdk: 2 new changesets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
That's true, but given cs is a String with length equal to this, cs.equals(this) nevertheless may return false, and
if (cs.equals(this)) return true; will not return. The remaining code performs the comparison a second time in this case.
Oh, now I see it - you are absolutely right :-)
- Previous message: java.lang.String#contentEquals(CharSequence) suboptimal?
- Next message: hg: jdk7/tl/jdk: 2 new changesets
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]