tags:

views:

35

answers:

1

For example, if I wanted if I wanted to parse the input arguments from a java program and use the input option as a key to get a variable name... i.e.

java optionTable 
------------------------------------------------------
option | option help | internal option variable name | 

I could implement this using brute force tactics, such as making an array of lists. Then creating a HashMap that maps array index to option name. But, it would be nice to know if there is an actual implementation for this?

Any comments/ "why don't you just use this are welcomed." Thanks.

A: 

Basically, you need a structure. In Java these are implemented in terms of classes.

So your ID maps to a object of a class which has all the needed fields.

For instance:

class Val {
     string OptionHelp;
     string InternalName;
}

and then you use HashMap

EFraim
Thanks for the response, just to make sure I get what you are saying...You suggest making a HashMap that maps keys to structures (implemented as classes)?Would you say the formal name for this would be HashTable?
Yes, I think this it the usual solution to such problems in C and C++ and seems to work fine in Java.
EFraim