code: public int attrValCompare(Object val, Attribute that,
                              boolean ignoreCase) throws NamingException {
      if (that.size() != 1) {
        NamingEnumeration ne = that.getAll();
  
        if (ne == null) {
          return -2;
        }
  
        while (ne.hasMore()) {
          Object o = ne.next();
          if (val instanceof String) {
            if (compareVal(o, (String)val, ignoreCase) == 0) {
              return 2;
            }
          } else if (o.equals(val)) {
            return 2;
          }
        }
        return -2;
      }
  
      /** that is a single valued attribute.
       */
      Object o = that.get();
  
      if (val instanceof String) {
        return compareVal(o, (String)val, ignoreCase);
      }
  
      if (o.equals(val)) {
        return 0;
      }
  
      return -2;
    }
docs: Compare the given single value with the attribute value(s).
  
  @param val
  @param that
  @param ignoreCase
  @return -2 for not equal or not present in multi-valued attribute
  -1 for val &lt; that
  0 for val = that
  1 for val &gt; that
  2 for val present in multi-valued attr
  @throws NamingException