users@jaxb.java.net

Re: equals() and hashCode()

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Wed, 03 Dec 2003 09:45:18 -0800

> I hadn't realised that the edges were labelled so agree that it won't be
> that complex in most cases, but on the other hand general deep-equality of
> objects would be (?) because there'd be no labels for some edges
>
> class A {
> Set children;
> ...
> }

I see. You are saying that comparing two general Sets for equality could
take O(mn) where m=sizeof(set1),n=sizeof(set2).


> (but Sets of elements don't seem to be supported in XML?)

You could say it's supported in XML. After all, it's just a
representation of data, and you can claim <set><a/><b/><c/></set> is a
representation of a set. However, you are right that the RI doesn't
support the binding to a set, although I see no reason why it
cannot/shouldn't.


> >It will break as soon as you start modifying those XML elements.
> >Could you also elaborate on why you want to put those on Set?
>
> sure - i'm dealing with a situation where you are keeping two xml files
> (source and target) in sync. with each other. We can't simply copy source
<snip/>

I see. Interesting. Thank you for the explanation. It makes a lot of
sense. I can't promise you anything, but I'll definitely think more
about this.

I filed an RFE for this: https://jaxb.dev.java.net/issues/show_bug.cgi?id=3

I presume in your schema, where you want to compare elements based on
their contents, they can't possibly have any cycles inside, can they?
(IOW, does the type system allows you to build a cycle in memory?)

regards,
--
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net