While it is true that the default text may simplify debugging,
I agree with the poster that this behavior violates
developers expectations (I don't know of any other API where
you have to call clear() before using an object the first time),
and because of that, it makes it more likely that bugs get
introduced in the first place.
Would you consider changing this so as to initialize with the
empty string?
Best regards
Jochen
But that would defeat the purpose of StringBuffer. You are using the constructor variant with len parameter mostly if you need to "convert" external data to String, for example in LoadFile.
If you want to start with empty string, please do not ask for non-empty one... (just do not put the length into the constructor).