Why switch case statement in Java doesnt allow string as input parameter?

Switches based on integers can be optimized to very efficent code. Switches based on other data type can only be compiled to a series of if() statements. For that reason C & C++ only allow switches on integer types, since it was pointless with other types.”

Other opinion is as soon that as you start switching on non-primitives you need to start thinking about “equals” versus “==”.

Firstly comparing two strings can be a fairly lengthy procedure, adding to the performance problems that are mentioned above.

Secondly if there is switching on strings there will be demand for switching on strings ignoring case, switching on strings considering/ignoring locale,switching on strings based on regex