三元运算

  public static URI getUri(InetSocketAddress namenode) {
    int port = namenode.getPort();
    String portString = port == DEFAULT_PORT ? "" : (":"+port);  //
    return URI.create("hdfs://"+ namenode.getHostName()+portString);
  }
原文地址:https://www.cnblogs.com/bokun-wang/p/3159328.html