commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tatu Vanhanen" <tatu.vanha...@graftor.fi>
Subject RE: [primitives] Looking for a primitive hashtable
Date Tue, 30 Mar 2004 07:06:31 GMT
> Your search is likely to be in vain ... primitives like "int" in Java
> are not actually objects.  The best you can do is make your keys
> instances of the corresponding wrapper classes (like java.lang.Integer)
> if you want to actually implement the java.util.Map contract.
>
> It's possible that the auto-boxing features in JDK 1.5 can create a
> convincing simulation that you're really using primitives as keys, but
> under the covers it will still be using wrapper objects even there.
>
> Craig

The above is certainly true, but despite of possibly being not compatible
with java.util.Map- interface, a dedicated primitive-keyed (or valued) map
would be powerful (meaning requiring less space and having better
performance) in many situations.

See http://trove4j.sourceforge.net/ for one implementation, especially
TIntObjectHashMap in http://trove4j.sourceforge.net/javadocs/. I would be
delighted to see something like this in commons-collections.

- Tatu V.


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


Mime
View raw message