Collection of bad coding practices

Archive for the ‘Strings’ Category

Unneccessary thread safety of StringBuffer

leave a comment »

Use StringBuilder rather then StringBuffer, unless synchronization is required. StringBuilder is not thread safe, and therefore avoids the synchronization overhead of StringBuffer.

(submitted by Robert J. Walker)


Written by Alex

August 22, 2008 at 4:07 am

Posted in Strings, Threads

Tagged with , ,

Not taking advantage of ‘toString()’

with 2 comments

Overriding toString() method gives you a cheap way to provide human-readable labels for objects in output. When the objects are used in GUI containers, such as JLists or JTables, it allows to use the default models and renderers instead of writing the custom ones.

Read the rest of this entry »

Written by Alex

November 22, 2007 at 11:16 pm

Posted in Objects, Strings

Tagged with ,