I've stuck by a few lines in my java program, which take too much time (about 20s), and it seems weird to me.
Here are the lines
Map<URL, Integer> res2 = new HashMap<>();
for (URL url : res) {
res2.put(url, null);
}
Which res defined as following :
List<URL> res = new ArrayList<>();
In my program, res.size() ~= 1500
Do you have any idea of where my problem could come from ?
Thanks !
The hashCode()
method of java.net.URL
performs DNS resolution. The URL
class is unsuitable for use in a HashSet
or as keys in a HashMap
. Use either Strings or java.net.URI
.
Here's some background:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With