• Post Reply Bookmark Topic Watch Topic
  • New Topic

StringBuffer

 
Yosi Hendarsjah
Ranch Hand
Posts: 166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anybody know why StringBuffer class doesn't override equals() and hashCode() methods?
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!