public boolean hasSingleResult() throws NamingException {
    List<String> allResults = getAllLdapNames();
    return allResults != null && allResults.size() == 1;
  }
Checks whether search result contains exactly one entry.
@return true if the search result contains a single entry.
@throws NamingException
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ldap/SearchResultHandler.java