Java - equals method

Java Conceptuel Diagram

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()

.

Utility

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();





Discover More
Card Puncher Data Processing
Design Pattern - (Static) Factory

The Factory pattern creates an instance of an object according to a given specification, sometimes provided as arguments, sometimes inferred. It's a dependency resolving approach. A factory class decouples...
Java Conceptuel Diagram
Java - Object (instance of a class)

An java/lang/Objectobject: stores its state in fields and exposes its behaviour through methods (functions in some programming languages). Methods operate on an object's internal state and serve...
Java Conceptuel Diagram
Java - Set (Collection)

This interface is a member of the Java Collections Framework. Set is a collection that cannot contain duplicate elements. This interface models the mathematical set abstraction and is used to represent...
Java Conceptuel Diagram
Java - hashCode Method

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



Share this page:
Follow us:
Task Runner