Java List Equal equals(List A, List B)

Here you can find the source of equals(List A, List B)

Description

equals

License

Open Source License

Declaration

public static boolean equals(List A, List B) 

Method Source Code

//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;
    }
}

Related

  1. equalLists(List list1, List list2)
  2. equalLists(List list1, List list2)
  3. equalLists(List one, List two)
  4. equalLists(List a, List b)
  5. equals(final List fromList, final List key, final int start)
  6. equals(List c1, List c2)
  7. equals(List list1, List list2)
  8. equals(List lst1, List lst2)
  9. equals(List l1, List l2)