What is the formal name for a table that maps multiple data to a single id?
For example, if I wanted if I wanted to parse the input arguments from a Java program and use the input opt开发者_JAVA百科ion 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."
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
精彩评论