Here you can find the source of compareExactOrder(Collection> c1, Collection> c2)
public static boolean compareExactOrder(Collection<?> c1, Collection<?> c2)
//package com.java2s; //License from project: Open Source License import java.util.Collection; import java.util.Iterator; public class Main { public static boolean compareExactOrder(Collection<?> c1, Collection<?> c2) { if (c1.size() != c2.size()) return false; Iterator<?> i1 = c1.iterator(); Iterator<?> i2 = c2.iterator(); while (i1.hasNext()) if (i1.next() != i2.next()) return false; return true; }//from w w w .jav a 2s . com }