• 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: 13071
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic