commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grumpoxl <mhawtho...@stargate.net>
Subject [lang] Pooled and mutable numbers.
Date Tue, 11 Mar 2003 07:44:22 GMT
Is there any interest in:

1) A mechanism for pooling Integers, Floats, Doubles, etc. as they are
created, to conserve memory.  For example, instead of having:

new Integer(1) 

scattered throughout the code, there could be a NumberPool class which
would allow:

NumberFactory.createInteger(1)

the values would be cached, and could use a WeakHashMap or something
similar to manage the cache.

2) Mutable versions of these same Objects.  There could be an interface
named Mutable with a setValue(Object) method, which could have
extensions for MutableInteger, MutableFloat, and so on.  I saw something
like this in JBoss and thought it seemed like an interesting idea.

Java already has some type of internal pooling for Strings, I think that
this type of pooling can be equally useful and may improve performance. 
Any thoughts?


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message