Class UrlExternalFormComparator

  • All Implemented Interfaces:
    java.io.Serializable, java.util.Comparator<java.net.URL>

    public class UrlExternalFormComparator
    extends java.lang.Object
    implements java.util.Comparator<java.net.URL>, java.io.Serializable
    A comparator of URL instances. Comparing URLs with their implementation of #equals() is bad because it may cause problems like DNS resolving, or other slow checks. This comparator uses the external form of an URL to make a simple comparison of two Strings.
    Since:
    1.5.6
    See Also:
    Serialized Form
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.net.URL url1, java.net.URL url2)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Comparator

        equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
    • Constructor Detail

      • UrlExternalFormComparator

        public UrlExternalFormComparator()
    • Method Detail

      • compare

        public int compare​(java.net.URL url1,
                           java.net.URL url2)
        Specified by:
        compare in interface java.util.Comparator<java.net.URL>