How to automatically convert if-else if statement to switch

前端 未结 7 2407
隐瞒了意图╮
隐瞒了意图╮ 2020-12-15 15:23

Is there a hot key or easy way to replace an if-else if statement with a switch in IntelliJ? I would prefer not to manually convert the if-else if statement to a switch. I

7条回答
  •  我在风中等你
    2020-12-15 16:12

    If it doesn't offer the replacement anymore, its probably because disabled feature on "Intentions". (Android studio (IntelliJ))

    Solution is simple:

    • File > Settings > Editor > Intentions - Search: "replace switch"

    or

    • File > Settings - Search: "replace switch" > Editor > Intentions

    and check the blank checkbox

提交回复
热议问题