Created
February 18, 2011 11:11
-
-
Save jgwhite/833547 to your computer and use it in GitHub Desktop.
Java switch on String value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ValueEnum enumval = ValueEnum.fromString(myString); | |
switch (enumval) { | |
case MILK : lap(); break; | |
case WATER: sip(); break; | |
case BEER : quaff(); break; | |
default : dance(); break; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment