Package com.linkare.commons.utils
Class EqualityUtils
- java.lang.Object
-
- com.linkare.commons.utils.EqualityUtils
-
public final class EqualityUtils extends Object
This class aggregates common functions to check for equality between objects.- Author:
- Paulo Zenida - Linkare TI
-
-
Constructor Summary
Constructors Modifier Constructor Description privateEqualityUtils()Hiding constructor so that this utility class cannot be instantiated from outside.
-
-
-
Method Detail
-
equals
public static <T> boolean equals(T object1, T object2)- Type Parameters:
T- the type of the arguments to check for equality. The objects being compared must be of the same type. Therefore, the clients of this method should, explicitly, specify the argument type, something likeEqualityUtils.. When that specification is not performed, through the automatic erasure mechanism within Java, the argument type is inferred to the highest class of both arguments (Object, when necessary).(s1, s2) - Parameters:
object1- The object to be compared from.object2- The object to be compared to.- Returns:
- Returns the equality between
object1andobject2where, ifobject1is null, thenobject2must be null as well. Otherwise, call equals on theobject1.
-
-