Here you can find the source of containsSameItemsInOrder(List> col1, List> col2)
public static boolean containsSameItemsInOrder(List<?> col1, List<?> col2)
//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; } }