Comparing array list of string array
问题 I want to compare two ArrayList of string arrays. List<String[]> list1 = new ArrayList<String[]>; List<String[]> list2 = new ArrayList<String[]>; list1.equals(list2); This will return false because equals method in ArrayList will do equals on the element. ListIterator<E> e1 = listIterator(); ListIterator<?> e2 = ((List<?>) o).listIterator(); while (e1.hasNext() && e2.hasNext()) { E o1 = e1.next(); Object o2 = e2.next(); if (!(o1==null ? o2==null : o1.equals(o2))) return false; } return !(e1