Java List Equal isEquals(List l1, List l2)

Here you can find the source of isEquals(List l1, List l2)

Description

is Equals

License

Open Source License

Declaration

public static boolean isEquals(List<? extends Object> l1, List<? extends Object> l2) 

Method Source Code


//package com.java2s;

import java.util.Iterator;
import java.util.List;

public class Main {
    public static boolean isEquals(List<? extends Object> l1, List<? extends Object> l2) {
        if (l1 == l2)
            return true;
        if (l1 == null)
            return l2 == null;
        if (l2 == null)
            return false;
        if (l1.size() != l2.size())
            return false;
        Iterator<? extends Object> iter1 = l1.iterator();
        Iterator<? extends Object> iter2 = l2.iterator();
        while (iter1.hasNext()) {
            Object o1 = iter1.next();
            Object o2 = iter2.next();
            if (o1 == o2)
                continue;
            if (o1 == null && o2 != null)
                return false;
            if (!o1.equals(o2))
                return false;
        }/*from   w  w  w . j av  a 2  s  .  c om*/
        return true;
    }
}

Related

  1. isEqual(List list1, List list2)
  2. isEqual(List from, List to)
  3. isEqualAsMultiset(List left, List right)
  4. isEqualIgnoringOrder(List left, List right)
  5. isEqualList(List list1, List list2)
  6. isEquals(List l1, List l2)