Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate switch statement skeleton with an enum

If have an enum in e.g. Day with SunDay, MunDay, etc. Is there an easy way to generate the switch statement as below ? There is so much to much by hand.

switch(day) {

     case SunDay :
            break;

     case MunDay :
            break;

     // and so on
}
like image 764
javaguy Avatar asked Nov 25 '25 14:11

javaguy


1 Answers

If you are using Eclipse IDE, you can construct a empty switch, and Eclipse will give you an option called 'Add missing case statements' to automatically generate the switch. See the imagem below:

(Open the image in another window to see it better.)

enter image description here

like image 147
JoaaoVerona Avatar answered Nov 27 '25 02:11

JoaaoVerona



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!