Java - equals method

> Procedural Languages > Java

1 - About

The equals method is used in implementation such as set implementation in order to be sure that there will be no duplicate objects.

If two objects are equal, they must have the same hashCode().

Advertising

3 - Utility

3.1 - org.apache.commons.lang.builder

package org.apache.commons.lang.builder;
EqualsBuilder comparator = new EqualsBuilder();
// Note that this compares case sensitive
comparator.append(name, other.name);
comparator.append(..., other....);
return comparator.isEquals();
lang/java/equals.txt · Last modified: 2017/09/13 21:21 by gerardnico