commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig McClanahan <craig...@apache.org>
Subject Re: [primitives] Looking for a primitive hashtable
Date Tue, 30 Mar 2004 06:39:43 GMT
Alex Karasulu wrote:

>Hello,
>
>I've been looking to see if we have a primitive hash table keyed by the 
>int primitive type laying around somewhere.  I could not find anything 
>in the primitives project but could have sworn I saw one here at Apache 
>somewhere.  Any idea where I could find one?  
>
>I'm probably outta luck if one does not exist in the primitives 
>packages.
>
>Alex
>
>  
>
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

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


---------------------------------------------------------------------
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