Has anyone got any preferences between using:

import java.util.*

or

import java.util.Vector
import java.util.Enumeration

etc.

(Yes, I know I should be using List instead of Vector :-)

Despite some articles trying to claim otherwise, there's really very little difference between the two as far as the code is concerned. In fact, you could argue that the import package.Type is actually slower than the import package.* variant as there's more text to be parsed.

The only real difference IMNSO is that if you have

import java.util.*

then this says 'This type is dependent on types in the java.util package"

whereas

import java.util.Vector
import java.util.Enumeration

says "I specifically depend on Vector and Enumeration in the java.util package"

People who use powerful IDEs (i.e.,they write the import statements for you) generally prefer the more verbose and detailed import types; those using text editors will no doubt prefer to use the package wildcards.

Any votes on which one is better/worse/standard?

Alex.



Reply via email to