check if two arrays are equal