Closed pschichtel closed 11 years ago
Thank you for the contribution. I agree that zero length strings are not appropriately handled; though, I'm not convinced that the short circuit is an improvement since it imposes a cost on clients that will never compare equal strings. That being said, I'm on the fence with this cost argument, since your short circuit adds only a linear amount of work to a quadratic algorithm. At this point, I'd like to cherry-pick your zero-length string correction. Please let me know if you'd like to separate this out as a contribution to the code base, or if you'd like me to simply push the fix. I'll add a unit test for the zero-length string scenario, when it is fixed, regardless.
You may just push the fix.
I added these short circuits to improve the performance and prevent a StringIndexOutOfBoundsException