Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Could extra imports in Java slow down code loading time?

Tags:

java

Is it possible that adding more import statements to your java code could slow down the time it takes to load your classes into the JVM?

like image 475
Kyle Avatar asked Mar 14 '10 01:03

Kyle


1 Answers

No, imports are only used in compilation to find class references. Add unused imports and they don't do anything. To put it another way:

import java.util.*;

simply means you can write:

Map map = new HashMap();

instead of:

java.util.Map map = new java.util.HashMap();

That's all it does.

like image 196
cletus Avatar answered Oct 01 '22 12:10

cletus