[Neo] Node identity
Anders Nawroth
anders.nawroth at gmail.com
Thu Jul 3 12:34:06 CEST 2008
hi!
Johan Svensson wrote:
> On Wed, Jul 2, 2008 at 4:48 PM, Peter Haensgen <P.Haensgen at intershop.de> wrote:
>> Hi,
>>
>>>> Are there any reasons for comparing nodes by their id and not use
>>> equals()?
>>
>> The proxy class that implements the Node interface therefore should
>> override the equals() method and compare the ids instead. I don't know
>> if that has been done, but I would think so.
>>
>
> Yes. All implementations of Node or Relationship interfaces have
> equals overridden. So always compare using id or equals method. Never
> use object reference compare since they may be different (this is true
> for relationship types too).
>
OK, I think this may be more of a documentation issue.
If all implementations do override equals() this maybe should be added
to and documented in the interface API to get some natural place to put
this information.
Or could there be a reason for an implementation not to
implement/override equals()? In that case, this really needs to be
documented somewhere ...
/anders
More information about the User
mailing list