I have a giant if/else block like below -
String s = getString();
if(s.contains("A")){
//case a
}
else if(s.contains("B")){
//case b
}
else if.....
Which I would like to convert to a switch block. However, I'm not sure how the syntax of that would work. Perhaps I would need to use pattern matching?
Aucun commentaire:
Enregistrer un commentaire