public boolean contains(KerberosIdentityDescriptor identity) {
    return used.stream().anyMatch(each -> identity.isShared(each));
  }
@return true if there is an identity in the used list with the same keytab or principal name than the given identity
ambari-server/src/main/java/org/apache/ambari/server/controller/utilities/UsedIdentities.java