Let's say I have below class:
package com.example;
public class Main {
public static void main(String[] args) {
ArrayList arrayList;
LinkedHashMap linkedHashMap;
LinkedList linkedList;
TreeMap treeMap;
List list;
}
}
How can I make IntelIJ automatically import when saving, without any additional need to press Alt+Enter for every class that was not yet imported? In this case I have to press Alt+Enter 5 times.
I understand that some classes can not be imported since there are more than one candidate ( in my Example List is present in java.util but also in java.awt), and the developer needs to pick the desired one.
But how about the classes for which there is exactly one package in the classpath ( in my example java.util is the only package in which a class named ArrayList is defined)
In Eclipse this issue can easily be handled by checking the "Organize Imports" on Save Actions(Java Editor->Save Actions)