Apr 3, 2022
Thank you so much for your response.
exactly, It would be a switch case as you said. but most developers started with if else. that's why I started with if-else but also, I mentioned the switch case as someone preference.
Exactly, the MAP should be encapsulated within the class. Since I want to point out the map usage instead of if-else / switch I didn't enforce the encapsulation for the map.
But those two points about map are valid,
Used map should be immutable and private to enhance the security as well as abstraction.
Thanks Gamehostporgram