I have extracted some integers from a text file and stored them in array of String. Now I want to make hash table from those integers (stored as string). Help.
building Hashtables from array of Strings
Collapse
X
-
Originally posted by vikas1008I have extracted some integers from a text file and stored them in array of String. Now I want to make hash table from those integers (stored as string). Help.
hi i have some suggestion ,these sugesstions are based an ur question as posted ,i don't know ur actual requirment
1. why you had taken a string array u can take directly an integer array
2.or can u iterate the array in loop and check every element inthe loop either it is string or integer
(if integer)
use Integer.parseIn t();
and put it in the HashTable.put(" KEY" ,Value);
ok i think this will give u an idea may not perfect solution i think because thisis based upon ur Query
regards
chiru -
or u can do one thing also if ur not able to put idivisusal arguments into hastable according to the hash table property the key and values are only string i think for that u can directly put string array(object) into hash table and assain that hastable object to a integer array or varable based on requirement then iterate for indivisual argumentsOriginally posted by ibahealthhi i have some suggestion ,these sugesstions are based an ur question as posted ,i don't know ur actual requirment
1. why you had taken a string array u can take directly an integer array
2.or can u iterate the array in loop and check every element inthe loop either it is string or integer
(if integer)
use Integer.parseIn t();
and put it in the HashTable.put(" KEY" ,Value);
ok i think this will give u an idea may not perfect solution i think because thisis based upon ur Query
regards
chiru
as like this
String demo_array []={6};
hashtable demo_hash=new HashTable();
demo_hash.put(" DemoValue",demo _array );
int demo_array1=dem o_hash.put("Dem oValue",demo_ar ray );
u can iterate this intewger vairable
regards
chiru[/QUOTE]Comment
-
Why did you read the values into an array first when you wanted to put them in a hashtable at the end?Originally posted by vikas1008I have extracted some integers from a text file and stored them in array of String. Now I want to make hash table from those integers (stored as string). Help.Comment
Comment