335 }
336 return (entries.size() - that.entries.size()); // longer RDN wins
337 }
338
339 /**
340 * Compares the specified Object with this Rdn for equality.
341 * Returns true if the given object is also a Rdn and the two Rdns
342 * represent the same attribute type and value mappings. The order of
343 * components in multi-valued Rdns (such as "ou=Sales+cn=Bob") is not
344 * significant.
345 * <p>
346 * Type and value equality matching is done as below:
347 * <ul>
348 * <li> The types are compared for equality with their case ignored.
349 * <li> String values with different but equivalent usage of quoting,
350 * escaping, or UTF8-hex-encoding are considered equal.
351 * The case of the values is ignored during the comparison.
352 * </ul>
353 * <p>
354 * If obj is null or not an instance of Rdn, false is returned.
355 * <p>
356 * @param obj object to be compared for equality with this Rdn.
357 * @return true if the specified object is equal to this Rdn.
358 * @see #hashCode()
359 */
360 public boolean equals(Object obj) {
361 if (obj == this) {
362 return true;
363 }
364 if (!(obj instanceof Rdn)) {
365 return false;
366 }
367 Rdn that = (Rdn) obj;
368 if (entries.size() != that.size()) {
369 return false;
370 }
371 for (int i = 0; i < entries.size(); i++) {
372 if (!entries.get(i).equals(that.entries.get(i))) {
373 return false;
374 }
375 }
|
335 }
336 return (entries.size() - that.entries.size()); // longer RDN wins
337 }
338
339 /**
340 * Compares the specified Object with this Rdn for equality.
341 * Returns true if the given object is also a Rdn and the two Rdns
342 * represent the same attribute type and value mappings. The order of
343 * components in multi-valued Rdns (such as "ou=Sales+cn=Bob") is not
344 * significant.
345 * <p>
346 * Type and value equality matching is done as below:
347 * <ul>
348 * <li> The types are compared for equality with their case ignored.
349 * <li> String values with different but equivalent usage of quoting,
350 * escaping, or UTF8-hex-encoding are considered equal.
351 * The case of the values is ignored during the comparison.
352 * </ul>
353 * <p>
354 * If obj is null or not an instance of Rdn, false is returned.
355 *
356 * @param obj object to be compared for equality with this Rdn.
357 * @return true if the specified object is equal to this Rdn.
358 * @see #hashCode()
359 */
360 public boolean equals(Object obj) {
361 if (obj == this) {
362 return true;
363 }
364 if (!(obj instanceof Rdn)) {
365 return false;
366 }
367 Rdn that = (Rdn) obj;
368 if (entries.size() != that.size()) {
369 return false;
370 }
371 for (int i = 0; i < entries.size(); i++) {
372 if (!entries.get(i).equals(that.entries.get(i))) {
373 return false;
374 }
375 }
|