public static boolean isArrayEquals (@Nullable final Object aHeadArray, @Nullable final Object aTailArray)
  {
    // Same objects?
    if (EqualsHelper.identityEqual (aHeadArray, aTailArray))
      return true;

    // Any of the null -> different because they are not both null
    if (aHeadArray == null || aTailArray == null)
      return false;

    // If any of the passed object is not an array -> not equal as an array,
    // even if they are equal!
    if (!isArray (aHeadArray) || !isArray (aTailArray))
      return false;

    // Different component type?
    if (!aHeadArray.getClass ().getComponentType ().equals (aTailArray.getClass ().getComponentType ()))
      return false;

    // Different length?
    final int nLength = Array.getLength (aHeadArray);
    if (nLength != Array.getLength (aTailArray))
      return false;

    // Compare step by step
    for (int i = 0; i < nLength; i++)
    {
      final Object aItem1 = Array.get (aHeadArray, i);
      final Object aItem2 = Array.get (aTailArray, i);
      if (isArray (aItem1) && isArray (aItem2))
      {
        // Recursive call
        if (!isArrayEquals (aItem1, aItem2))
          return false;
      }
      else
      {
        // Use equals implementation
        if (!EqualsHelper.equals (aItem1, aItem2))
          return false;
      }
    }

    // No differences found!
    return true;
  }
public static boolean isArrayEquals ( @ Nullable final Object aHeadArray , @ Nullable final Object aTailArray ) { if ( EqualsHelper . identityEqual ( aHeadArray , aTailArray ) ) return true ; if ( aHeadArray == null || aTailArray == null ) return false ; if ( ! isArray ( aHeadArray ) || ! isArray ( aTailArray ) ) return false ; if ( ! aHeadArray . getClass ( ) . getComponentType ( ) . equals ( aTailArray . getClass ( ) . getComponentType ( ) ) ) return false ; final int nLength = Array . getLength ( aHeadArray ) ; if ( nLength != Array . getLength ( aTailArray ) ) return false ; for ( int i = 0 ; i < nLength ; i ++ ) { final Object aItem1 = Array . get ( aHeadArray , i ) ; final Object aItem2 = Array . get ( aTailArray , i ) ; if ( isArray ( aItem1 ) && isArray ( aItem2 ) ) { if ( ! isArrayEquals ( aItem1 , aItem2 ) ) return false ; } else { if ( ! EqualsHelper . equals ( aItem1 , aItem2 ) ) return false ; } } return true ; }
Recursive equal comparison for arrays.

@param aHeadArray
First array. May be <code>null</code>.
@param aTailArray
Second array. May be <code>null</code>.
@return <code>true</code> only if the arrays and all contained elements are
recursively equal.