java的组织导入在,Intellij IDEA:如何更改组织导入功能

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?

解决方案

Open the Settings:

Code style -> Java -> Import Tab

in the first section (General) there is an option for Use single class import and at the end of the section two value fields where you can set the limit of classes in the imported package until idea starts to import *

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值