Class EqualsUtil

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

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

    • 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 != {}

    • bothNotNull

      public static boolean bothNotNull(Object a, Object b)