Class ObjectUtils


  • public final class ObjectUtils
    extends Object
    This utility class provides several useful Object-related methods.

    All functions have been implemented with extreme caution in order to provide a maximum performance.

    Version:
    $Revision$ $Date$
    • Method Detail

      • equalObjects

        public static boolean equalObjects​(Object object1,
                                           Object object2)
        Indicates whether the given objects are "equal to" each other.

        This method should be used in place of the Object.equals if one ore both arguments can be null.

        If both objects are arrays of the same primitive types the comparision is delegated to the corresponding java.util.Arrays.equals method.

        If both objects are object arrays with equal lengths, the method is recursively called for each array element pair. If the first pair is not equal, the method immediately returns false.

        Parameters:
        object1 - the first object, can be null
        object2 - the second object, can also be null
        Returns:
        true if this first object equals the second; false otherwise.
        See Also:
        Arrays.equals(long[], long[])