Can you use Strings as 'values' in a hashtable?

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Oct 2009
Posts: 10
Reputation: skiplatte is an unknown quantity at this point 
Solved Threads: 0
skiplatte skiplatte is offline Offline
Newbie Poster

Can you use Strings as 'values' in a hashtable?

 
0
  #1
Oct 29th, 2009
Pretty much what the title says!! Basically I want to store method generated Strings and then plug them into another method - would hashtable be a way to do this??

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,450
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 262
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven
 
0
  #2
Oct 29th, 2009
Strings can, of course be values in a hastable, but what does that have to do with the rest of the question?

What do you mean by "method generated Strings" and "plug them into another method"?

Also, whatever it is, HashMap would probably be a better choice than Hashtable, unless you have some specific reason for synchronizing access to it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,450
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 262
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven
 
0
  #3
Oct 29th, 2009
Strings can, of course be values in a hastable, but what does that have to do with the rest of the question?

What do you mean by "method generated Strings" and "plug them into another method"?

Also, whatever it is, HashMap would probably be a better choice than Hashtable, unless you have some specific reason for synchronizing access to it.
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 10
Reputation: skiplatte is an unknown quantity at this point 
Solved Threads: 0
skiplatte skiplatte is offline Offline
Newbie Poster
 
0
  #4
Oct 29th, 2009
Originally Posted by masijade View Post
Strings can, of course be values in a hastable, but what does that have to do with the rest of the question?

What do you mean by "method generated Strings" and "plug them into another method"?

Also, whatever it is, HashMap would probably be a better choice than Hashtable, unless you have some specific reason for synchronizing access to it.
Basically I have a method (tokenizer, but thinking about looking at regex) which splits an input string into smaller strings are r and k and i want to be able to used those substrings to calculate the mass of them (from values stored in a hashmap). So probably thinking about it I'll need to make an array of substrings?

Thanks
Reply With Quote Quick reply to this message  
Join Date: Feb 2006
Posts: 2,450
Reputation: masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of masijade has much to be proud of 
Solved Threads: 262
Moderator
masijade's Avatar
masijade masijade is offline Offline
Nearly a Posting Maven
 
0
  #5
Nov 3rd, 2009
I have no idea what you are talking about.

Maybe you should provide a bit of a sample of the data you start with and then a detailed explanation of what you are doing with it (showing the modifications to that data).
Java Programmer and Sun Systems Administrator

----------------------------------------------

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
--Brian Kernighan
Reply With Quote Quick reply to this message  
Reply

Message:


Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC