This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

importing entire package or just needed classes

 
JohnV Varghese
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,
Which is better
import java.util.*;
or
import java.util.List;
with respect to performance!!!
Thanks!!!
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
    Bookmark Topic Watch Topic
  • New Topic