mercredi 7 janvier 2015

Obtaining a resultant from the mapping of 2 variables

I am looking for a way to take two variables chipNum and channel and map them into another variable ComboPin. chipNum can have a value of 1 - 5 and channel can be 0 - 23. Depending on the combination, something like: (1,9) -> (11) (2,10) -> (37) (3,15) -> (66)


Note that chipNum and channel are of type String and I would like ComboPin to be of type String as well.


I am trying to avoid using a bunch of if statement conditions or case statements.


I have done some research and seen the hash mapping or map.put() but I have only seen this with one value being mapped to another. I am just looking for which direction I can go in doing this.


The resultant (ComboPin) would then be placed into my database. Thanks for any help I can get.


Aucun commentaire:

Enregistrer un commentaire