aspose file tools
The moose likes Java in General and the fly likes mapping a int value Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "mapping a int value" Watch "mapping a int value" New topic
Author

mapping a int value

nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
hello
I have this code below which maps out my string keys with string values; once it has maped them out it gets the string keys in the order that they are maped out at.
my problem is that i want to map some integers out with them ( int keys[]={0,1,2,3,4,5,6,7,8,9} )
How would i do this?
please help me
nicky
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
ints are primitives, they can't be stored in hashmaps. Use the Integer wrapper class, and store those wrappers in the hashmap:

kind regards
nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
Hello jos
I do not understand what you mean could you please descibe in more detail please
thankyou
nicky
Veena Rani
Ranch Hand

Joined: Mar 09, 2000
Posts: 34
You can create another hashtable that will map the values in the int array to either key or value
of your original key or value array.For this you have to convert int primitive type to Integer object because in the hashtable you can use only objects as key or value.
Then use this hashtable as key or value to construct the final hashtable.
Veena
nicky sajdok
Greenhorn

Joined: Jan 22, 2003
Posts: 14
Could you be so kind and give me some code examples as im stuck with this
thanks
nicky
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: mapping a int value
 
Similar Threads
getting the int value
How can you do this
use hashtables instead of strings
how can i pull out every number from a vector
commit() and rollback() problem!