When String (an immutable [not modifiable] type) construction or modification involving dynamic values (whose values are not known at compile time) is required by a single thread, the mutable String
Builder will perform faster than String
Buffer. The reason for the performance hit is likely that StringBuffer is thread-safe through synchronization. StringBuilder is also mutable but not thread-safe, hence the faster predicted performance.
No comments:
Post a Comment