How to optimize imports automatically after each save in IntelliJ IDEA

Viewed 53181

I want to learn how can I automatically optimize imports after each save as we do Eclipse(save actions).

4 Answers

First step:

CTRL + SHIFT + A or CMD + SHIFT + A (for mac)

Second step:

Search Optimize imports

Third step:

Switch ON the option

enter image description here

In version 'Ultimate 2016.2' it is:

File > Other Settings > Default Settings > Auto Import > Optimize imports on the fly

Related