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
service/src/java/org/apache/hive/service/auth/ldap/SearchResultHandler.java