java.net.URI#hashCode ( )源码实例Demo

下面列出了java.net.URI#hashCode ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: dragonwell8_jdk   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码2 项目: TencentKona-8   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码3 项目: jdk8u60   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码4 项目: green_android   文件: SPV.java

private PeerAddress getPeerAddress(final String address) throws URISyntaxException, UnknownHostException {
    final URI uri = new URI("btc://" + address);
    final String host = uri.getHost();

    if (host == null)
        throw new UnknownHostException(address);

    final NetworkData networkData = mService.getNetwork();
    final int port = uri.getPort() == -1 ? networkData.getNetworkParameters().getPort() : uri.getPort();

    if (!isProxyEnabled() && !getTorEnabled())
        return new PeerAddress(networkData.getNetworkParameters(), InetAddress.getByName(host), port);

    return new PeerAddress(networkData.getNetworkParameters(), host, port) {
               @Override
               public InetSocketAddress toSocketAddress() {
                   return InetSocketAddress.createUnresolved(host, port);
               }

               @Override
               public String toString() {
                   return String.format("%s:%s", host, port);
               }

               @Override
               public int hashCode() {
                   return uri.hashCode();
               }
    };
}
 
源代码5 项目: openjdk-jdk8u   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码6 项目: openjdk-jdk8u-backup   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码7 项目: openjdk-jdk9   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码8 项目: jdk8u-jdk   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码9 项目: hottub   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码10 项目: openjdk-8-source   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码11 项目: openjdk-8   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码12 项目: jdk8u_jdk   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码13 项目: GreenBits   文件: SPV.java

private PeerAddress getPeerAddress(final String address) throws URISyntaxException, UnknownHostException {
    final URI uri = new URI("btc://" + address);
    final String host = uri.getHost();

    if (host == null)
        throw new UnknownHostException(address);

    final int port = uri.getPort() == -1? mService.getNetworkParameters().getPort() : uri.getPort();

    if (!mService.isProxyEnabled())
        return new PeerAddress(mService.getNetworkParameters(), InetAddress.getByName(host), port);

    return new PeerAddress(mService.getNetworkParameters(), host, port) {
        @Override
        public InetSocketAddress toSocketAddress() {
            return InetSocketAddress.createUnresolved(host, port);
        }

        @Override
        public String toString() {
            return String.format("%s:%s", host, port);
        }

        @Override
        public int hashCode() {
            return uri.hashCode();
        }
    };
}
 
源代码14 项目: jdk8u-jdk   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码15 项目: jdk8u-dev-jdk   文件: Test.java

static void eq0(URI u, URI v) throws URISyntaxException {
    testCount++;
    if (!u.equals(v))
        throw new RuntimeException("Not equal: " + u + " " + v);
    int uh = u.hashCode();
    int vh = v.hashCode();
    if (uh != vh)
        throw new RuntimeException("Hash codes not equal: "
                                   + u + " " + Integer.toHexString(uh) + " "
                                   + v + " " + Integer.toHexString(vh));
    out.println();
    out.println(u + " == " + v
                + "  [" + Integer.toHexString(uh) + "]");
}
 
源代码16 项目: wildfly-core   文件: LdapEntry.java

LdapEntry(final String simpleName, final String distinguishedName, final URI referralURI) {
    this.simpleName = simpleName;
    this.distinguishedName = distinguishedName;

    this.referralURI = referralURI;

    hashCode = (simpleName == null ? 7 : simpleName.hashCode())
            * (distinguishedName == null ? 31 : distinguishedName.hashCode()
            * (referralURI == null ? 37 : referralURI.hashCode()));
}
 
源代码17 项目: cxf   文件: Key.java

public Key(final URI uri, final String accept) {
    this.uri = uri;
    this.accept = accept;

    int result = uri.hashCode();
    result = 31 * result + (accept != null ? accept.hashCode() : 0);
    this.hash = result;
}
 
源代码18 项目: tomee   文件: ServerMetaData.java

public int buildHash() {
    int locationsHash = 0;
    for (final URI location : this.locations) {
        locationsHash += location.hashCode();
    }
    return locationsHash;
}
 
源代码19 项目: XACML   文件: IdentifierImpl.java

@Override
public int hashCode() {
	URI thisURI	= this.getUri();
	return (thisURI == null ? super.hashCode() : thisURI.hashCode());
}