I hope you are well.
Am I correct in thinking that the StringBuffer and StringBuilder classes DO NOT override the Object equals() method? So their versions of equals() uses "=="? Is this a valid work around?
I am away from my normal PC at present and do not have a JDK installed on this one or I'd check it out myself.
stringbuffer1 = "hi"';
stringbuffer2 = "hi";
System.out.println((stringbuffer1.toString()).equals(stringbuffer2.toString())); // will it print true?
The difference is, as already said, that most methods in StringBuffer are synchronized, while they are not in StringBuilder. The engineers at Sun realized that for most applications, synchronization is not necessary, but it does add some runtime overhead.