From: Ben A. <ben...@ac...> - 2007-01-10 22:53:32
|
Matt Benson wrote: > Ben: Thanks for the report. I applied your patch and > made a couple of changes, the largest of which is the > use of a class imported from Apache Ant: > IdentityStack. I wrote this class when it became > evident that this type of use case--excluding objects > from double-processing--really calls for identity > comparisons rather than equality comparisons. The > recursion factor only applies when two objects are > truly the same instance, after all. > > Thanks again, Hi Matt IdentityStack huh. Nice. :-) I wasn't too bothered about identity vs equality given the default equality handling falls back to identity anyway. But I take your point, identity is preferred as it overcomes the rather frequently erroneous equals(Object) implementations that people write. One other alternative might have been use to System.identityHashCode(Object) and store that, thus achieving identity without needing an extra class. :-) Thanks for applying the patch. Cheers Ben |