Java Object Compare areEqual(Object first, Object second, boolean equalEvenIfBothNull)

Here you can find the source of areEqual(Object first, Object second, boolean equalEvenIfBothNull)

Description

are Equal

License

Apache License

Declaration

public static boolean areEqual(Object first, Object second, boolean equalEvenIfBothNull) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static boolean areEqual(Object first, Object second, boolean equalEvenIfBothNull) {
        return (equalEvenIfBothNull ? areEqualEvenIfBothNull(first, second) : areEqual(first, second));
    }//from  ww w .ja  v a 2  s  .c o m

    private static boolean areEqual(Object first, Object second) {
        return (first != null && second != null && first.equals(second));
    }

    private static boolean areEqualEvenIfBothNull(Object first, Object second) {
        return ((first == null && second == null) || (first != null && second != null && first.equals(second)));
    }
}

Related

  1. areEqual(final Object object0, final Object object1)
  2. areEqual(final Object x, final Object y)
  3. areEqual(final T object1, final T object2)
  4. areEqual(Object aThis, Object aThat)
  5. areEqual(Object first, Object second)
  6. areEqual(Object o1, Object o2)
  7. areEqual(Object o1, Object o2)
  8. areEqual(Object o1, Object o2)
  9. areEqual(Object o1, Object o2)