The ReferenceMap in the CVS has the ability to weakly reference keys in a
variety of ways. But it doesn't use == testing. Really ReferenceMap could do
with being a subclass of HashedMap, then adding Identity behaviour would be
easy.

HashedMap has worked out really well so far, and I added a load more
override possibilities tonight, so it should cover most subclass
requirements now..

Stephen


----- Original Message -----
From: "Brian S O'Neill" <[EMAIL PROTECTED]>
> The "IdentityMap" caught my attention. I wrote a map with the same name
> awhile back which had one extra feature. The keys were weakly
> referenced. I think the name "WeakIdentityMap" is more sensible. The
> implementation would clean out cleared entires as they were discovered
> and before expansions. If space is freed up, then the expansion in
> canceled. This map can be safely used in place of IdentityMap, but it
> may have extra performance and storage overhead.
>
> Anyhow, I'm wondering if you think that the extensible HashedMap
> contains enough "override" points to make this sort of map possible
> without having to implement from WeakIdentityMap from scratch. I think
> all the necessary override points are there, I'll just have to see if it
> works.
>
> http://teatrove.sourceforge.net/javadoc/com/go/trove/util/IdentityMap.html
>
> Stephen Colebourne wrote:
>
> >A number of new classes now form a hierarchy in the map subpackage:
> >
> >HashedMap (general hash map)
> >
> >IdentityMap extends HashedMap  (uses ==)
> >
> >LinkedMap extends HashedMap  (insertion order)
> >
> >LRUMap extends LinkedMap  (access order, drops oldest)
> >
> >
> >Is everyone happy with this hierarchy?
> >Should LRUMap (access order) extend LinkedMap (insertion order) (lots of
> >code shared)?
> >Should there be an AbstractHashedMap class, rather than all extending
> >HashedMap?
> >
> >We're going to have to live with this so it needs to be right.....;-)
> >
> >Also, should caching and reusing of previous MapEntry objects be part of
the
> >default implementations?
> >
> >Finally, I think that StaticBucketMap and ReferenceMap don't benefit from
> >extending HashedMap, but if someone wants to confirm or deny this they're
> >most welcome :-0
> >
> >Stephen
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to