Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!us.feeder.erje.net!goblin1!goblin3!goblin.stu.neva.ru!rt.uk.eu.org!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.help Subject: Re: Safety Of Non-Synchronized Collections Date: Wed, 09 Jan 2013 12:17:11 -0800 Organization: Canadian Mind Products Lines: 26 Message-ID: References: Reply-To: Roedy Green NNTP-Posting-Host: K2Qzzs3EAqXk5RLzfhxcSw.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: csiph.com comp.lang.java.help:2414 On Thu, 3 Jan 2013 15:30:59 -0800 (PST), Lew wrote, quoted or indirectly quoted someone who said : > >Well, there's the fact that StringBuffer is not thread-safe. Sun advertised it as such even if it were not perfectly so. When StringBuilder was announced in JDK 1.5 Sun had this to say about StringBuilder http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/StringBuilder.html A mutable sequence of characters. This class provides an API compatible with StringBuffer, but with no guarantee of synchronization. This class is designed for use as a drop-in replacement for StringBuffer in places where the string buffer was being used by a single thread (as is generally the case). Where possible, it is recommended that this class be used in preference to StringBuffer as it will be faster under most implementations. ... Instances of StringBuilder are not safe for use by multiple threads. If such synchronization is required then it is recommended that StringBuffer be used. -- Roedy Green Canadian Mind Products http://mindprod.com Students who hire or con others to do their homework are as foolish as couch potatoes who hire others to go to the gym for them.