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:

A

Popular Posts (Last 30 days)

This is a personal blog and I do not speak for my employer.