Class EqualsUtil

java.lang.Object
org.opencastproject.util.EqualsUtil

public final class EqualsUtil extends Object
Utility function helping to implement equality.
  • Method Details

    • eqObj

      @Deprecated public static boolean eqObj(Object a, Object b)
      Deprecated.
      Check if a and b are equal. Each of them may be null.
    • eq

      @Deprecated public static boolean eq(Object a, Object b)
      Deprecated.
      Check if a and b are equal. Each of them may be null.
    • ne

      public static boolean ne(Object a, Object b)
      Check if a and b are not equal. Each of them may be null.
    • eqClasses

      public static boolean eqClasses(Object a, Object b)
      Check if a and b have the same class (Object.getClass()). Each may be null.
    • eqListUnsorted

      public static boolean eqListUnsorted(List<?> as, List<?> bs)
      Compare the (distinct) elements of two lists for equality treating the lists as sets.

      Sets by definition do not allow multiplicity of elements; a set is a (possibly empty) collection of distinct elements. As Lists may contain non-unique entries, this method removes duplicates before continuing with the comparison check. Examples of 1. equality: {1, 2} = {2, 1} = {1, 1, 2} = {1, 2, 2, 1, 2}, null = null 2. unequal: {1, 2, 2} != {1, 2, 3}, null != {}

    • eqListSorted

      public static boolean eqListSorted(List<?> as, List<?> bs)
      Compare the elements of two lists one by one.
    • eqMap

      public static boolean eqMap(Map<?,?> as, Map<?,?> bs)
      Compare two maps.
    • bothNotNull

      public static boolean bothNotNull(Object a, Object b)
    • hash

      @Deprecated public static int hash(Object... as)
      Deprecated.
      Create a hash code for a list of objects. Each of them may be null. Algorithm adapted from "Programming in Scala, Second Edition", p670.