From: Doug C. <de...@fl...> - 2002-02-23 17:46:59
|
> entrysets support "element removal, which removes the corresponding mapping > from the map, via the Iterator.remove, Set.remove, removeAll, retainAll and > clear operations". These are all caught by SetProxy and IteratorProxy. > Also we do need to worry about catching setValue(). <snip> > An alternative (slower) approach might be to fully diff all collections > against their persistent state (this only happens with arrays now and is > somewhat harder to implement for Sets and Maps). The thing is that lazy > initialization requires this cool wrapper class and I'm keen to make use > of it to save time diffing as well. Ah, I thought this was true of sets and maps already, which is why I wasn't concerned about Map.Entry#setValue(). I misinterprested the comment: * Changes to _structure_ of the collection are recorded by the * collection calling back to the session. Changes to mutable * elements (ie. composite elements) are discovered by cloning their * state when the collection is initialized. I was wrongly assuming how this was being done. Now I see. I've added a new EntrySetProxy EntryIteratorProxy and MapEntryProxy to Map and used it in SortedMap as well. The MapEntryProxy instances are created lazily in the iterator. In retrospect I could have extended SetProxy to create EntrySetProxy -- there are only a few differences, the biggest, of course, is to use EntryIteratorProxy. e |