class OzoneAclUtil {

  public static boolean addAcl(List<OzoneAcl> existingAcls, OzoneAcl acl) {
    if (existingAcls == null || acl == null) {
      return false;
    }

    for (OzoneAcl a: existingAcls) {
      if (a.getName().equals(acl.getName()) &&
          a.getType().equals(acl.getType()) &&
          a.getAclScope().equals(acl.getAclScope())) {
        BitSet current = a.getAclBitSet();
        BitSet original = (BitSet) current.clone();
        current.or(acl.getAclBitSet());
        if (current.equals(original)) {
          return false;
        }
        return true;
      }
    }

    existingAcls.add(acl);
    return true;
  }

  private  OzoneAclUtil();

}