Can Eclipse convert if-else to switch for enums

前端 未结 2 1757
说谎
说谎 2021-01-14 05:32

ReShaper can automatically recognize if states on enums and offer to convert them to switch statements (or back). (Of course, this can only happen

2条回答
  •  北海茫月
    2021-01-14 06:31

    Eclipse can convert switch statements to if-else but not the other way around. There is already a bug open to provide a "Convert 'if-else' to 'switch'" quick assist, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=348179

    Update: The bug has been fixed, Starting 4.3 Milestone 1 Eclipse will support converting if-else statements to switch statements.

提交回复
热议问题