Monday, July 4, 2005

Java SE 5.0: What's the difference between a StringBuffer and StringBuilder?

What's the difference between a StringBuffer and StringBuilder?

The StringBuilder class was introduced with JDK 5.0. Essentially, a StringBuffer is a thread-safe version of StringBuilder. If you are only adding/removing characters from a single-thread, the StringBuilder implementation will be faster. If you are using multiple threads to add and remove characters, use StringBuffer.

No comments:

Total Pageviews

Reading List - 05-Mar-23

Talking to #AI may be the most important job skill of this century ( JohnGoodPasture ) Role of account management over the years. It’s a ro...