A switch on String idiom for Java

I’ve always been frustrated with the inability to write a switch on String in Java. However the enum type introduced in Java 5.0 somewhat diminishes the issue. Read this excellent article on the subject.


Java 7 now supports switch on String!