473,396 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

building Hashtables from array of Strings

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.
Nov 13 '07 #1
5 2688
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.

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.parseInt();
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
Nov 13 '07 #2
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.parseInt();
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 arguments
as like this
String demo_array []={6};
hashtable demo_hash=new HashTable();
demo_hash.put("DemoValue",demo_array );
int demo_array1=demo_hash.put("DemoValue",demo_array );
u can iterate this intewger vairable
regards
chiru[/quote]
Nov 13 '07 #3
r035198x
13,262 8TB
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.
Why did you read the values into an array first when you wanted to put them in a hashtable at the end?
Nov 13 '07 #4
heat84
118 100+
Remember that hashtables dont store nulls.
Nov 19 '07 #5
JosAH
11,448 Expert 8TB
Remember that hashtables dont store nulls.
Ints can never be null.

kind regards,

Jos
Nov 19 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Olaf Meyer | last post by:
Sometimes if find it clumsy unsing the following approach building strings: cmd = "%s -start %s -end %s -dir %s" % (executable, startTime, endTime, directory) Especially if you have a lot of...
3
by: Cengiz Dincoglu | last post by:
When I insert a long value as key and the object to a hashtable. it fails at about 600,000 data points. ht.add(long, long) We are developing a real time application that is required to keep...
6
by: Michael Schollmeyer | last post by:
Hello, The following code writes the text string: Uri uri1 = new Uri("http://www.here.net/aplace?param=one"); Uri uri2 = new Uri("http://www.here.net/aplace?param=two"); int h1 =...
3
by: Greg Oetker via .NET 247 | last post by:
I have an issue where I have some structs and do to the slowsearching for a match of a unsorted Array I need to useHashtables. The issue comes into play when I want to modify thecontents of the...
6
by: Dennis | last post by:
I was trying to determine the fastest way to build a byte array from components where the size of the individual components varied depending on the user's input. I tried three classes I built: (1)...
2
by: Terrance | last post by:
Hello, I have a question in regards to hashtables that I was hoping someone can share some light on. I'm currently working with VB.net and I'm trying to learn as much as possible about the...
17
by: john | last post by:
All: I'm a long-time developer, new to PHP.... Is there an idiom used in PHP to construct SQL statments from $_POST data? I would guess that in many applications, the data read from $_POST...
7
by: Kamran Shafi | last post by:
Hi, I am creating an arraylist (say masterArrayList) of hashtables, where each hashtable (say table) is of the format key=string, value = arraylist of strings (say existing_strings). In a...
7
by: Mike P | last post by:
I have 2 hashtables each of which I am using to store a set of IDs and Descriptions. Hashtable 1 will have the full set of data (e.g. IDs 1,2,3,4,5) whereas Hashtable 2 will only have a subset of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.