i want to implement Switch Case based on String,
java 1.7 is supporting Switch Case with String, but for before version's, it can be possible with Enum. Is this the best and standard way to implement.
Example
public enum MethodType {
DOUBLE,LIST,STRING,ARRAYLIST,FLOAT,LONG;
}
public static void main( String[] args ) {
String value = "DOUBLE";
switch( MethodType.valueOf( value ) ) {
case DOUBLE:
System.out.println( "It's a double" );
break;
case LIST:
System.out.println( "It's a list" );
break;
}
}