StringBuilder - IV
10 August 2008Do read the previous parts of this post for better understanding.
If obj refers to an instance of a StringBuilder, then obj.append(x) has the same effect as obj.insert(sb.length(), x). Do remember that every string builder has a capacity. As long as the length of the character sequence contained in the string builder does not exceed the capacity, it is not necessary to allocate a new internal buffer. If the internal buffer overflows, it is automatically made larger and this is an expensive operation.
Instances of StringBuilder are not safe for use by multiple threads. If such synchronization is required then it is recommended that StringBuffer be used.
Related Posts:
Top Of Page | Trackback
If you found this page useful, consider linking to it. Simply copy and paste the code below into your web site.
It will look like this: StringBuilder - IV