Skip to content

Instantly share code, notes, and snippets.

@dagezi
Created June 2, 2015 12:54
Show Gist options
  • Save dagezi/55cd0e90510c7c37069e to your computer and use it in GitHub Desktop.
Save dagezi/55cd0e90510c7c37069e to your computer and use it in GitHub Desktop.
http://java.net .URL#equals resolves domain name!
import java.net.URL;
public class UrlTest {
public static void main(String argv[]) throws Exception {
URL url1 = new URL("http://squiare.github.io/");
URL url2 = new URL("http://google.github.io/");
System.out.println(
String.format("\"%s\".equals(\"%s\") = %b",
url1.toString(),
url2.toString(),
url1.equals(url2)));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment