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






Author Info:

Rakesh (He/Him) has a Masters Degree in Computer Science with over 15+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org

Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap