java use external enum in another class switch statement

Solutions on MaxInterview for java use external enum in another class switch statement by the best coders in the world

showing results for - "java use external enum in another class switch statement"
Luigi
11 Mar 2020
1Determine the enum value represented by the int value and then switch on the enum value.
2
3enum GuideView {
4    SEVEN_DAY,
5    NOW_SHOWING,
6    ALL_TIMESLOTS
7}
8
9// Working on the assumption that your int value is 
10// the ordinal value of the items in your enum
11public void onClick(DialogInterface dialog, int which) {
12    // do your own bounds checking
13    GuideView whichView = GuideView.values()[which];
14    switch (whichView) {
15        case SEVEN_DAY:
16            ...
17            break;
18        case NOW_SHOWING:
19            ...
20            break;
21    }
22}
Camilla
03 Mar 2016
1private enum FooNum {
2  //Options for your enum
3  A, 
4  B
5  }
6
7public void foo(FooNum fooNum){
8
9switch(fooNum){
10	case A:		
11	    //you selected A
12    	break;
13  	case B:
14    	//you selected B
15		break;  
16  	default:			
17	    //do some stuff
18	    break;
19	} 
20}
21
queries leading to this page
using enum in switch expression javajava enum switchswitch case with enumswitch statement java with enumjava switch case with enumwhat is the use of enum with switch in javajava switch enum valueswitch statement java enumenum with switch case in javaswitch case con enumswitch case enum with string javaenum in switch case javaenum switch case javaswitch case for enum in javausing string enum in switch case javaswitch case java enumswitch by enum javaenum type java in switch java switch enumswitch statement enum javajava switch by enumdeclare enum java inside a class and access from another classusing the switch fopr the enums in javaswitch statement java for enum classesswitch case for enum javaswitch statement java on enumuse case of enum in javajava 8 switch case with enumswitch case in java for enumjava enum switch statementhow to use enum in java switchenumeration in switch case javacase switch enum javaswitch name enum javahow to use enum in switch case java 8switch enum javajava enum attribute to switch caseenums in switch case javaenum with methods java switch case stringswitch with enum java 8switch case java with enumjava switch over enum classjava switch statement with enumenum in different classswithc case in java with enumenum class switch statement main javajava enum and switchdefault case for enum switch javause enum in switch case javaswitch case enum in javajava use enum in switchswitch case with enum javaswitch statements using enumswitch case string enum javajava use enum as type in switchjava enum switch case unqualifieduse java enums with values in switch caseswitch for default in enum javajava switch with enumjava 8 switch on enumjava switch case with enum in void methodjava switch case add all enums switch case with equals for enum matching java java enum and switch casejava case enumjava enum with values switch caseenum switch case in javacan we use enum in switch case javaenum with methods java and switch case stringjava switch on enumswitch in java enumshow to put enum in switch case javaswitch case with enum in javaenumeration in switch statement javaenum switch javaswitch java enumswitch case on enum in javahow to implement enum switch cases in javajava use external enum in another class switch statementswitch with enum javajava switch statement enumenum and switch syntax javaenum in switch case java 8enum with methods java and switchcan i create s switch in java using enumjava switch case enumuse java enums in switch casejava enum caseusing switch case with enum javajava switch case enum string examplejava switch enum examplecan enum be used in switch case in javausing enum with switch case in javajava enum switch caseenum in java switch caseswitch on enum javaswitch case enum javahow to use switch case with enum in javaenum java switchjava enum with switch casejava 8 switch enumjava switch enum caseenum in java example with switch caseswitch name of enum javajava switch case with enum exampleuse of java enum in switch case statementjava use external enum in another class switch statement