String or StringBuffer ? what about StringBuilder?

The usual advice is to use StringBuffer when you are going to mutate the String. The reason is well known – String is immutable and its costlier to create new objects than appending using StringBuffer.  But StringBuffer is thread-safe, meaning every append or toString method call will acquire a lock on the StringBuffer object. There is an alternative to this well – StringBuilder!!

It was introduced in java 1.5 and its not synchronized which could help you get a little more out of your code esp when you are using a method or local scope variable.

RK

Free, Safe and Clean Dating Network

Singapore Apartment Rentals and Property Classifieds

This entry was posted in Technology and tagged , . Bookmark the permalink.

4 Responses to String or StringBuffer ? what about StringBuilder?

  1. hariprasad says:

    hai i am looking hear lifeartnar ples

  2. hariprasad says:

    hai i am looking hear life partnar ples text me if u interest to exchange detail hear ples shariprasad27@yahoo.com

    • manjula says:

      Hi dis is manju frm bangalore i hav gon through ur profil in matrimony if ur really intrested pls call 9663015672

  3. manjula says:

    I hav gon through ur profil Pls call if ur intrested 9663015672

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s