I'm currentlly refactoring an application using a lot of this:
StringBuffer buff1 = new StringBuffer("");
buff1.append("some value A");
buff1.append("");
buff1.append("some value B");
The coder that made those code lines didn't seems to be an idiot, is there any reasons I can't see to use the append("") to a StringBuffer?
Nope.
And given that they're hardcoded strings, it'd be identical to write
buff1 = new StringBuffer("some value Asome value B");
BTW, it's a bit more efficient to use a StringBuilder rather than a StringBuffer (and the API is identical).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With