简体   繁体   中英

Intellij IDEA: how to change the organize import feature

I would like to know how can I avoid to make IntelliJ IDEA to automatically consolidate all the classes of a package with the * . For exameple let's say I have the following classes imported:

import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;

now if I write later on a bit of code like the following:

List list = new ArrayList();

I can type alt + enter on either List or ArrayList in order to automatically import them. The problem is that once I do that, automatically IntelliJ IDEA consolidates all the imports with java.util.* instead of adding the single class.

I have seen the tab "organize imports" but it's not what I am looking for. What I would like to have is that in such case as the one I have above described, when typing alt + enter I get added the single class along the others of the same package rather than having all of them consolidated in java.util.*; .

Does anybody know how to do that?

在第一部分(常规)中打开设置:代码样式-> Java->导入选项卡,其中有一个使用单个类导入的选项,在该部分的末尾有两个值字段,您可以在其中设置导入的类的限制打包,直到想法开始导入*

Note that in IntelliJ 14, Ultimate there is also an option under: SETTINGS | EDITOR | CODE STYLE | JAVA | IMPORTS | to "Use fully Qualified class names".

If you check this it will NOT import your classes (as long as they're in your classpath).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM