For any URI u, it is always the case that
new URI(u.toString()).equals(u) .
For any URI u that does not contain redundant syntax such as two slashes before an empty authority (as in file:///tmp/ ) or a colon following a host name but no port (as in http://java.sun.com: ), and that does not encode characters except those that must be quoted, the following identities also hold:
new URI(u.getScheme(),
u.getSchemeSpecificPart(),
u.getFragment())
.equals(u)
in all cases,
new URI(u.getScheme(),
u.getUserInfo(), u.getAuthority(),
u.getPath(), u.getQuery(),
u.getFragment())
.equals(u)
if u is hierarchical, and
new URI(u.getScheme(),
u.getUserInfo(), u.getHost(), u.getPort(),
u.getPath(), u.getQuery(),
u.getFragment())
.equals(u)
if u is hierarchical and has either no authority or a server-based authority.