Java Object Equal equals(Object o1, Object o2)

Here you can find the source of equals(Object o1, Object o2)

Description

Tests if specified objects are equal using equals().

License

Open Source License

Declaration

public static final boolean equals(Object o1, Object o2) 

Method Source Code

//package com.java2s;

public class Main {
    /**/*from   w w w. java  2  s. c o  m*/
     * Tests if specified objects are equal using <code>equals()</code>.
     * Unlike with <code>equals()</code>, both objects may be
     * <code>null</code> and two <code>null</code> objects are always
     * considered to be equal.
     * <p>This function is missing in java.util.Arrays which, on the other
     * hand, has all the other functions: <code>Arrays.equals(boolean[],
     * boolean[])</code>, <code>Arrays.equals(byte[], byte[])</code>, ...,
     * <code>Arrays.equals(Object[], Object[])</code>.
     */
    public static final boolean equals(Object o1, Object o2) {
        return ((o1 == null && o2 == null) || (o1 != null && o1.equals(o2)));
    }
}

Related

  1. equals(BSONObject a, BSONObject b)
  2. equals(final Object a, final Object b)
  3. equals(Object a, Object b)
  4. Equals(Object in1, Object in2)
  5. equals(Object o1, Object o2)
  6. equals(Object o1, Object o2)
  7. equals(Object object1, Object object2)
  8. equals(Object thisObj, Object thatObj)
  9. equals(Object v1, Object v2)