Organizing Existing Import Statements

The Java editor can help you improve the existing import statements inside a compilation unit.

1.

Do one of the following while editing your Java code:

  • Select Organize Imports from the context menu in the editor
  • Select Edit > Organize Imports from the menu bar.
  • Press Ctrl+Shift+O

2.

The Java editor generates a complete list of import statements, as specified by the import order preference.

See Setting the Order of Import Statements

3.

New import statements replace the old ones.