Here you can find the source of equalsIgnoreSequence(Object[] array1, Object[] array2)
public static boolean equalsIgnoreSequence(Object[] array1, Object[] array2)
//package com.java2s; //License from project: Apache License import java.util.Arrays; import java.util.List; public class Main { public static boolean equalsIgnoreSequence(Object[] array1, Object[] array2) { if ((array1 == null) && (array2 == null)) { return true; } else if ((array1 == null) || (array2 == null)) { return false; }/*from www. jav a 2 s. c o m*/ if (array1.length != array2.length) { return false; } List<Object> list = Arrays.asList(array2); for (int i = 0; i < array1.length; i++) { Object o1 = array1[i]; if (!list.contains(o1)) { return false; } } return true; } public static boolean contains(Object[] array, Object obj) { return -1 < indexOf(array, obj); } public static boolean contains(char[] array, char ch) { return -1 < indexOf(array, ch); } public static int indexOf(Object[] array, Object obj) { if (array != null) { for (int i = 0; i < array.length; ++i) { Object o = array[i]; if (o != null) { if (o.equals(obj)) { return i; } } else if (obj == null) { return i; } } } return -1; } public static int indexOf(char[] array, char ch) { if (array != null) { for (int i = 0; i < array.length; ++i) { char c = array[i]; if (ch == c) { return i; } } } return -1; } }