[jdom-interest] Re: Attribute comparison

Guy Nirpaz guyn at tantian.com
Tue Dec 5 02:18:16 PST 2000


I have to add:

The answer for the question in the FAQ gives good explanation why Element
should not implement value equality. I think it's a fair design decision for
container components such as Element, but I'm not sure it's a good decision
for elements such as Attribute, Comment, PI and CDATA.

Guy


> Hi,
>
> I have two identical JDOM trees. I'd like to compare two attributes that
> have the same values from both of the trees. I've noticed that the
> Attribute.equals() method of Attribute (and other JDOM elements) only
checks
> for reference equality. This means that the result of :
>
> (att1 == att2) and (att1.equals(att2)) is the same.
>
> Is there any reason for this. (I remember several months ago there was
> discussion in the list about that, but I can't really find it)
>
> Shouldn't we implement the equals() method for the basic constructs such
as
> Attribute and Comment (and others)?
>
> Thanks,
>
> Guy Nirpaz
>
> Tantian Corp.
> guyn at tantian.com
>




More information about the jdom-interest mailing list