Package org.apache.pinot.spi.utils
Class EqualityUtils
- java.lang.Object
-
- org.apache.pinot.spi.utils.EqualityUtils
-
public class EqualityUtils extends Object
Various utilities in implementingObject.equals(Object)andObject.hashCode(). For primitive float and double,isEqual()is not the same as Java == operator,isEqual(NaN, NaN)returns true instead of false.
-
-
Method Summary
Modifier and Type Method Description static inthashCodeOf(int previousHashCode, boolean value)static inthashCodeOf(int previousHashCode, int value)static inthashCodeOf(int previousHashCode, long value)static inthashCodeOf(int previousHashCode, Object o)static inthashCodeOf(Object o)Given an object, return the hashcode of it.static booleanisEqual(byte left, byte right)static booleanisEqual(char left, char right)static booleanisEqual(double left, double right)Compare both arguments for equality, and considerDouble.NaNto be equal toDouble.NaN(unlike the Java == operator).static booleanisEqual(float left, float right)Compare both arguments for equality, and considerFloat.NaNto be equal toFloat.NaN(unlike the Java == operator).static booleanisEqual(int left, int right)static booleanisEqual(long left, long right)static booleanisEqual(short left, short right)static booleanisEqual(Object[] left, Object[] right)static booleanisEqual(Object left, Object right)static booleanisEqualIgnoreOrder(List left, List right)static booleanisEqualMap(Map left, Map right)static booleanisEqualSet(Set left, Set right)static booleanisNullOrNotSameClass(Object left, Object right)static booleanisSameReference(Object left, Object right)
-
-
-
Method Detail
-
isEqual
public static boolean isEqual(int left, int right)
-
isEqual
public static boolean isEqual(long left, long right)
-
isEqual
public static boolean isEqual(float left, float right)Compare both arguments for equality, and considerFloat.NaNto be equal toFloat.NaN(unlike the Java == operator).
-
isEqual
public static boolean isEqual(double left, double right)Compare both arguments for equality, and considerDouble.NaNto be equal toDouble.NaN(unlike the Java == operator).
-
isEqual
public static boolean isEqual(short left, short right)
-
isEqual
public static boolean isEqual(char left, char right)
-
isEqual
public static boolean isEqual(byte left, byte right)
-
isEqualIgnoreOrder
public static boolean isEqualIgnoreOrder(@Nullable List left, @Nullable List right)
-
isNullOrNotSameClass
public static boolean isNullOrNotSameClass(@Nonnull Object left, @Nullable Object right)
-
isSameReference
public static boolean isSameReference(@Nullable Object left, @Nullable Object right)
-
hashCodeOf
public static int hashCodeOf(@Nullable Object o)Given an object, return the hashcode of it. Fornull, return 0 instead.
-
hashCodeOf
public static int hashCodeOf(int previousHashCode, @Nullable Object o)
-
hashCodeOf
public static int hashCodeOf(int previousHashCode, int value)
-
hashCodeOf
public static int hashCodeOf(int previousHashCode, long value)
-
hashCodeOf
public static int hashCodeOf(int previousHashCode, boolean value)
-
-