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

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -