Hello

2013/11/15 Stanislas Nanchen <[email protected]>

> Hi,
>
> I'm currently using the JGraphT library to load Records and have them in a
> Tree as Vertices and ForeignKeys as edges.
>

That sounds quite interesting :-)


> Unfortunately, because equals() and hashCode() are computed with the
> values of the fields and the Records are mutable entities, it is not
> possible to put Records in Sets without breaking the contract of Set. (and
> JGraphT uses Sets for its implementation, eg. the set of Vertices).
>

I'm not quite sure why you cannot put Records in Sets. You can also put
ArrayLists in Sets, if you can "guarantee" client-side immutability.

Of course, it's better to avoid putting potentially mutable objects into a
Set, but if the Set is only used for constructing a graph, then I would
imagine you can ensure that Records won't be modified for the time being...?

Of course, I could store AtomicReferences of my Records, but it is a bit
> inconvenient.
> I could also use Immutable Beans, but our application is (unfortunately)
> built on mutable structures.
>
> Does anyone have a good solution for this problem?
>

Maybe, you should describe a bit more what you're doing / why you're doing
it. I'm a bit confused by the idea of putting generally mutable structures
into Sets. What is the concrete problem you're solving?

Cheers
Lukas

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to