This method calls Pattern.compile()
inside a loop with constant arguments. If this Pattern
will be used several times, there's no reason to compile it on each loop iteration.
This method or field is or uses a Map
or Set
of URL
s. Since both the equals
and hashCode
method of URL
perform domain name resolution, this can result in a big performance hit.
Creating a String
using object creation wastes memory because the new String
object so constructed will be functionally indistinguishable from the String
value passed as a parameter. Just use the string directly.
This method uses toArray
with a non-zero sized array argument. This is less efficient than passing a zero-sized array.
This method accesses the value of a Map entry, using a key that was retrieved from a keySet
iterator. It is more efficient to use an iterator on the entrySet
of the map, to avoid the Map.get(key)
lookup.