2

In Google's Java style guide they suggest to always use Single class imports, but they don't give a reason. What are the reasons to adopt this style of importing single classes instead of *?

Also, side question, how to I set up IntelliJ to optimize my imports in this fashion?

Jon Erickson
  • 112,242
  • 44
  • 136
  • 174
  • Polluting your namespace reduces the number of names you can use locally without confusion. The last two words of that sentence are the most important part. – Tripp Kinetics Jul 31 '15 at 21:02

1 Answers1

4

Importing all the classes in a package increases the probability of name clash.

That said, nowadays IDEs can write the imports for you.

Andy Thomas
  • 84,978
  • 11
  • 107
  • 151