java - Insufficient String Buffer Declaration -
i use tool check coding style , got many advise :
stringbuffer constructor initialized size 16, has @ least 35 characters appended.
here of code:
final stringbuffer contents = new stringbuffer();
why whould happen?
how did count 35 characters
?
how can edit size of stringbuffer ?
or method should use solve problem??
changing capacity of stringbuffer
after has been created more costly creating expected needed capacity.
use constructor remove warning:
/** * constructs string buffer no characters in , * specified initial capacity. * * @param capacity initial capacity. * @exception negativearraysizeexception if <code>capacity</code> * argument less <code>0</code>. */ public stringbuffer(int capacity) { super(capacity); }
Comments
Post a Comment