Java List Contain containsSameItemsInOrder(List col1, List col2)

Here you can find the source of containsSameItemsInOrder(List col1, List col2)

Description

contains Same Items In Order

License

Open Source License

Declaration

public static boolean containsSameItemsInOrder(List<?> col1, List<?> col2) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static boolean containsSameItemsInOrder(List<?> col1, List<?> col2) {
        if (col1 == col2)
            return true;
        if (col1 == null || col2 == null)
            return false;
        if (col1.size() != col2.size())
            return false;
        Iterator<?> it1 = col1.iterator();
        Iterator<?> it2 = col2.iterator();
        while (it1.hasNext()) {
            if (!it1.next().equals(it2.next()))
                return false;
        }/*from w w  w.  j a  va  2s .c  om*/
        return true;
    }
}

Related

  1. containsOnlyEmptyValues(List list)
  2. containsOnlyNulls(List list)
  3. containsOnlySequentialNumbers(List values)
  4. containsOrIsEmpty(List list, Object item)
  5. containsReference(List references, Object toBeFound)
  6. containsStr(List list, String str)
  7. containsStringStartingWith(List list, String prefix)
  8. containsSubsequence(List a, List b)
  9. containsType(List list, Class type)