在编写代码时,IDEA可以自动导入需要的包,可以提高开发的效率。MacOS X环境下设置如下:
ItelliJ Idea->preference→Editor→General→Auto Import
选中Optimize imports on the fly和Add unambiguous imports on the fly; 点击apply 和OK键。
Optimize imports on the fly:自动去掉一些没有用到的包
Add unambiguous imports on the fly:自动帮我们优化导入的包