Here you can find the source of equals(List A, List B)
public static boolean equals(List A, List B)
//package com.java2s; /********************************************************************** * Copyright (c) 2007 IBM Corporation.// w ww . j a v a 2 s. com * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ import java.util.Iterator; import java.util.List; public class Main { public static boolean equals(List A, List B) { if (A == null && B == null) return true; if (A == null && B != null) return false; if (A != null && B == null) return false; if (A.size() != B.size()) return false; for (Iterator i = A.iterator(); i.hasNext();) { if (!B.contains(i.next())) return false; } return true; } }