posted 9 years ago
Hi,I have two string variables,they could have 20x5 combinations,how can i implement the code to check on specific combination,"if else" is not good design,I can not use "switch" on string,"enum" is not good too,what is the better solution for this?
SCJP 5.0<br />SCWCD1.4<br />SCBCD5
posted 9 years ago
If the action is same for all the string matches then populate them in a static string list and use contains.
Sunil Kumar
> Think Witty <
Sunil Kumar
Ranch Hand
Posts: 81
posted 9 years ago
If the actions are different use a hashmap to define the actions for each type of match
Note : These are just opinions, others may vary
[ December 29, 2008: Message edited by: Sunil Kumar ]
Note : These are just opinions, others may vary
[ December 29, 2008: Message edited by: Sunil Kumar ]
Sunil Kumar
> Think Witty <

It is sorta covered in the JavaRanch Style Guide. |