Default import style in Eclipse
Change it to suite your style
do you import class in Java? Do you import each class explicitly or use
the wildcard character to import the complete package? There are
aesthetic pros and cons with either approach. There is no performance
impact with either approach.
Eclipse provides a useful shortcut to Organize Imports: Ctrl + Shift + O. By default this imports each class explicitly. Not very useful when you want to import using the wildcard character.
There is a way to control how Eclipse organizes imports. Go to Window>Preferences>Java>Code Style>Organize Imports. There is an option to set the “Number of imports needed for .*“. Set that to “1“. This way you will always have the imports organized with the wildcard character.
You can also go hybrid by setting this value to say “5” and Eclipse will start using .* after five explicit imports. Cool.