Call me old-fashioned, but I like to keep an eye on my imports, even if
it
I had the opposite experience. When I did the imports by hand, I tended
to use on-demand imports, such as "java.util.*". With Eclipse doing the
bookkeeping, I stick to single class imports. The length of the import
list is a much better indication of the number of imported classes.
I've always used on-demand imports (except when needing to disambiguate
collisions).. simply because for 95% of my Java career I've used an editor
which did not help me with the imports side of coding [Multi-Edit for
Windows, aka MEW].
Although I can see your argument, I'm not going to start changing my style.
The reason isn't ego or stubborness but as follows ;-)
When you only use single class imports, then most real-life classes will
have an import list that will easily exceed one screen full (50 lines?). I'd
like to guess that a lot of your classes may even have lists longer than two
screen fulls, and there's no way I would consider this a readable
alternative to my neat, compact lists. Here's a typical import "section" in
my code (the comments are vertically aligned on my screen):
import org.lv.lego.*; // TimeAndDateKit
import org.lv.lego.adt.*; // Pair
import org.lv.lego.debug.*; // DebugSupport, Debugable
import org.lv.lego.math.*; // MathKit
import org.lv.lego.selftest.*; // Testable, SelfTestPrintStream
import java.awt.*; // Canvas, Graphics2D
import java.awt.event.*; // MouseMotionListener, KeyListener
import java.awt.geom.*; // GeneralPath
import java.beans.*; // PropertyChangeSupport
// avoid collision with AWT
import java.util.List;
... as you can see, I like to add notes of which *key* classes I import via
the on-demand style. I don't know any IDE which does that kind of thing, so
I'm stuck doing it manually. The net result is a compact, informative
listing which can be read very quickly to get the essential info without
having to scroll down a huge list.
Your fully explicit style contains a lot of "information noise".. for
example when doing AWT or Swing work, you'll almost invariably be using
Colour... but I really don't want to have to read this in my imports list,
because that's a trivial dependency. The same applies to many other types
(like IOException, InputStream, etc..). I want my imports to be compact and
show me the essence of what I need to know to get a picture of what kind of
other things the current class is relying on.