我想知道如何避免让 IntelliJ IDEA 自动将包的所有类与*
。例如,假设我导入了以下类:
import java.util.Arrays;
import java.util.Scanner;
import java.util.Collections;
现在,如果我稍后写一些如下代码:
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.*;
.
有人知道该怎么做吗?
打开设置:
代码样式 -> Java -> 导入选项卡
在第一部分(常规)中有一个选项使用单类导入在该部分的末尾有两个值字段,您可以在其中设置导入包中的类限制,直到idea开始导入*
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)