commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <ggreg...@seagullsw.com>
Subject RE: WeakIdentityMap
Date Fri, 20 Feb 2004 05:55:37 GMT
Hello,

Ideally, you would use Bugzilla (http://issues.apache.org/bugzilla/) for
each feature you want to integrate in Commons and attach the relevant
sources as patches (http://jakarta.apache.org/commons/patches.html) to the
current CVS HEAD with JUnit test cases. 

Using the current CVS head will allow you to see if a feature you are
considering for donation has perhaps already been added ;-) But for truly
standalone classes, simple attachements to the ticket would be fine of
course (with the Apache 2.0 License).

IMO, integration of patches/files which include JUnit test cases with decent
coverage should be considered normal submission etiquette. 

Cheers,
Gary

> -----Original Message-----
> From: Brian S O'Neill [mailto:broneill@earthlink.net]
> Sent: Thursday, February 19, 2004 19:55
> To: Jakarta Commons Developers List
> Subject: WeakIdentityMap
> 
> I've been maintaining an open source project for some time that I'd like
> to break up, and move the more useful components into other, more
> appropriate projects. The TeaTrove project
> (http://teatrove.sourceforge.net/) contains a few lonely collections
> classes, which I think fit quite nicely in the Jakarta Commons project.
> 
> The first class I'd like to submit is named IdentityMap in TeaTrove,
> which is better named as WeakIdentityMap. This name change also resolve
> a name conflict. There are a few key differences between WeakIdentityMap
> and (commons) IdentityMap:
> 
> First, keys are weakly referenced. If IdentityMap is being used only for
> key-value lookups, then swapping in a WeakIdentityMap will not change
> behavior. If the key object is gone, you can't look it up, so the entry
> might as well be garbage collected. WeakIdentityMap provides the
> behavior that WeakHashMap should, because it enforces the identity
> lookup that WeakHashMap merely encourages.
> 
> Second, values are compared by the equals method, much like ordinary
> maps do. IdentityMap compares values by identity only. I'm not sure why
> this decision was made, but WeakIdentityMap can be modified to follow
> this behavior for the sake of consistency.
> 
> I've also made a few changes to WeakIdentityMap from its original source
> in TeaTrove. It now supports null keys. Also, the TeaTrove version used
> to remove cleared entries even during accessor operations, which
> sometimes caused problems. WeakIdentityMap only removes cleared entries
> when calling put or remove.
> 
> Although WeakIdentityMap is essentially a hashed map, I was not able to
> make it extend AbstractHashedMap. The put and remove operations need to
> perform special operations to detect and remove cleared entries, and the
> entry class has special methods and also extends WeakReference. The test
> case for WeakIdentityMap can probably extend the IdentityMap test case,
> but some minor changes are required in TestIdentityMap.
> 
> Is it best for me to attach the WeakIdentityMap source(s) as an
> attachment and send it to the developers list or is there a better way
> to make submissions?
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message