IntelliJ Keyboard Shortcut to remove unused imports [Java]

If you are using IDEA IntelliJ IDE for your Java Project and want to remove unused import statements from a Java class file, you can use the keyboard shortcut: Option + Shift + Enter if you are on macOS and Control + Shift + Enter if on Windows

You will see all unused imports in gray color,

IntelliJ Java unused import statements
Keyboard Shortcuts to remove unused Java Import Statements:
macOS:   Option + Shift + Enter
Windows: Alt + Shift + Enter

You may also hover over the un-used imports and select the Optimize Imports

Unused import Optimization IntelliJ

Top Hashtags: