GeeCON Prague 2014*
The moose likes Java in General and the fly likes importing entire package or just needed classes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Reply locked New topic
Author

importing entire package or just needed classes

JohnV Varghese
Greenhorn

Joined: Oct 09, 2003
Posts: 7
Hi,
Which is better
import java.util.*;
or
import java.util.List;
with respect to performance!!!
Thanks!!!
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
There is no difference in performance.
A Java import only comes into play at compile time, and then ONLY the required classes are pulled in. This makes it somewhat different from a C++ include which pulls everything in.
With that said, for production classes many shops insist that you name the exact classes that you want imported for documentation purposes.


"JavaRanch, where the deer and the Certified play" - David O'Meara
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Please don't post the same question in multiple forums. It takes time for people to answer, which is wasted if the poster doesn't realize the question has already been aswered elsewhere. Followups can go here. Thanks.


"I'm not back." - Bill Harding, Twister
 
GeeCON Prague 2014
 
subject: importing entire package or just needed classes