This week's book giveaway is in the Java 9 forum. We're giving away four copies of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications and have Sander Mak & Paul Bakker on-line! See this thread for details.
Does anybody know why StringBuffer class doesn't override equals() and hashCode() methods?
Author and all-around good cowpoke
posted 13 years ago
Probably because it would make for confused programming. Since the contents could be modified after storing the StringBuffer in a collection, the identity equals is what you want, not a content based one. Bill