Any way (or shortcut) to auto import the classes in IntelliJ IDEA like in Eclipse?

前端 未结 7 2129
无人及你
无人及你 2020-12-04 09:43

In Eclipse, while coding in Java and press Ctrl + Shift + O auto import all the Classes automatically.
In NetBeans, this is done with

7条回答
  •  Happy的楠姐
    2020-12-04 10:28

    I think the best solution, though not exactly the same as Eclipse/Netbeans, is to change the 'Optimize Imports' settings.

    Under Preferences > Editor > General > Auto Import

    Set Add unambiguous imports on the fly

    Edit: Using this method, when there are ambiguous imports, IntelliJ will let you know, and you can then use Alt + Enter method outlined in the answer by Wuaner

    I find that, almost always, the most appropriate Import is at the top of the list.

提交回复
热议问题