commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grumpoxl <>
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:


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:
For additional commands, e-mail:

View raw message