850 *
851 * Note: The defined behavior for {@code equals} is known to
852 * be inconsistent with virtual hosting in HTTP.
853 *
854 * @param obj the URL to compare against.
855 * @return {@code true} if the objects are the same;
856 * {@code false} otherwise.
857 */
858 public boolean equals(Object obj) {
859 if (!(obj instanceof URL))
860 return false;
861 URL u2 = (URL)obj;
862
863 return handler.equals(this, u2);
864 }
865
866 /**
867 * Creates an integer suitable for hash table indexing.<p>
868 *
869 * The hash code is based upon all the URL components relevant for URL
870 * comparison. As such, this operation is a blocking operation.<p>
871 *
872 * @return a hash code for this {@code URL}.
873 */
874 public synchronized int hashCode() {
875 if (hashCode != -1)
876 return hashCode;
877
878 hashCode = handler.hashCode(this);
879 return hashCode;
880 }
881
882 /**
883 * Compares two URLs, excluding the fragment component.<p>
884 *
885 * Returns {@code true} if this {@code URL} and the
886 * {@code other} argument are equal without taking the
887 * fragment component into consideration.
888 *
889 * @param other the {@code URL} to compare against.
890 * @return {@code true} if they reference the same remote object;
|
850 *
851 * Note: The defined behavior for {@code equals} is known to
852 * be inconsistent with virtual hosting in HTTP.
853 *
854 * @param obj the URL to compare against.
855 * @return {@code true} if the objects are the same;
856 * {@code false} otherwise.
857 */
858 public boolean equals(Object obj) {
859 if (!(obj instanceof URL))
860 return false;
861 URL u2 = (URL)obj;
862
863 return handler.equals(this, u2);
864 }
865
866 /**
867 * Creates an integer suitable for hash table indexing.<p>
868 *
869 * The hash code is based upon all the URL components relevant for URL
870 * comparison. As such, this operation is a blocking operation.
871 *
872 * @return a hash code for this {@code URL}.
873 */
874 public synchronized int hashCode() {
875 if (hashCode != -1)
876 return hashCode;
877
878 hashCode = handler.hashCode(this);
879 return hashCode;
880 }
881
882 /**
883 * Compares two URLs, excluding the fragment component.<p>
884 *
885 * Returns {@code true} if this {@code URL} and the
886 * {@code other} argument are equal without taking the
887 * fragment component into consideration.
888 *
889 * @param other the {@code URL} to compare against.
890 * @return {@code true} if they reference the same remote object;
|