Here you can find the source of isEqual(List
public static <E extends Object> boolean isEqual(List<E> from, List<E> to)
//package com.java2s; //License from project: LGPL import java.util.ArrayList; import java.util.Collection; import java.util.List; public class Main { public static <E extends Object> boolean isEqual(List<E> from, List<E> to) {//from ww w . ja va 2 s.c o m return (getCommonElements(from, to).size() == from.size()) && (from.size() == to.size()); } public static <E extends Object> List<E> getCommonElements( List<E> from, List<E> to) { List<E> res = new ArrayList<E>(); for (int i = 0; i < from.size(); i++) { if (hasElement(to, from.get(i))) { res.add(from.get(i)); } } return res; } public static <E extends Object> List<E> getCommonElements( List<List<E>> sets) { List<E> set = getCommonElements(sets.get(0), sets.get(1)); for (int i = 2; i < sets.size(); i++) { set = getCommonElements(set, sets.get(i)); } return set; } public static <E extends Object> List<E> getCommonElements( Collection<E> from, Collection<E> to) { List<E> res = new ArrayList<E>(); for (E f : from) { for (E t : to) { if (f.equals(t)) { res.add(f); } } } return res; } public static <E extends Object> boolean hasElement(List<E> array, E element) { boolean res = false; for (int i = 0; i < array.size(); i++) { if (array.get(i).equals(element)) { res = true; break; } } return res; } }