code: 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();
      }
docs: http://michaelscharf.blogspot.co.il/2006/11/javaneturlequals-and-hashcode-make.html