Java List First Item equalLists(List first, List second)

Here you can find the source of equalLists(List first, List second)

Description

equal Lists

License

GNU General Public License

Declaration

public static boolean equalLists(List<?> first, List<?> second) 

Method Source Code

//package com.java2s;
/*/* ww w .  j  a v a 2s.  c  om*/
 *    Fernflower - The Analytical Java Decompiler
 *    http://www.reversed-java.com
 *
 *    (C) 2008 - 2010, Stiver
 *
 *    This software is NEITHER public domain NOR free software 
 *    as per GNU License. See license.txt for more details.
 *
 *    This software is distributed WITHOUT ANY WARRANTY; without 
 *    even the implied warranty of MERCHANTABILITY or FITNESS FOR 
 *    A PARTICULAR PURPOSE. 
 */

import java.util.List;

public class Main {
    public static boolean equalLists(List<?> first, List<?> second) {

        if (first == null) {
            return second == null;
        } else if (second == null) {
            return first == null;
        }

        if (first.size() == second.size()) {
            for (int i = 0; i < first.size(); i++) {
                if (!equalObjects(first.get(i), second.get(i))) {
                    return false;
                }
            }
            return true;
        }

        return false;
    }

    public static boolean equalObjects(Object first, Object second) {
        return first == null ? second == null : first.equals(second);
    }
}

Related

  1. addFirst(List list, Object values)
  2. addFirstAndRemoveOldIfNeed(List dest, List src)
  3. cons(P first, List list)
  4. expectedOrder(List src, Object first, Object second)
  5. extractFirst(int numberToExtract, List list)
  6. first(final List list)
  7. first(final List list, final int oridinal)

  8. HOME | Copyright © www.java2s.com 2016