private static Collection<URL> distinctUrls(Collection<URL> urls) {
        Map<String, URL> distinct = new HashMap<>(urls.size());
        for (URL url : urls) {
            distinct.put(url.toExternalForm(), url);
        }
        return distinct.values();
    }
private static Collection<URL> distinctUrls(Collection<URL> urls) {
        Map<String, URL> distinct = new HashMap<>(urls.size());
        for (URL url : urls) {
            distinct.put(url.toExternalForm(), url);
        }
        return distinct.values();
    }
private static Collection < URL > distinctUrls ( Collection < URL > urls ) { Map < String , URL > distinct = new HashMap <> ( urls . size ( ) ) ; for ( URL url : urls ) { distinct . put ( url . toExternalForm ( ) , url ) ; } return distinct . values ( ) ; }
http://michaelscharf.blogspot.co.il/2006/11/javaneturlequals-and-hashcode-make.html
http : // michaelscharf . blogspot . co . il / 2006 / 11 / javaneturlequals - and - hashcode - make . html