Java Collection Compare compareExactOrder(Collection c1, Collection c2)

Here you can find the source of compareExactOrder(Collection c1, Collection c2)

Description

compare Exact Order

License

Open Source License

Declaration

public static boolean compareExactOrder(Collection<?> c1, Collection<?> c2) 

Method Source Code

//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
}

Related

  1. compare(final Collection c0, final Collection c1, final Comparator c)
  2. compareAnyOrder(Collection c1, Collection c2)
  3. compareCollections(Collection a, Collection b)
  4. compareCollections(Collection cola, Collection colb)
  5. compareCollections(Collection value1, Collection value2)
  6. compareRef(final Collection left, final Collection right)
  7. compareSet(Collection s1, Collection s2)
  8. compareTo(Collection o1, Collection o2)
  9. compareTo(Collection a, Collection b)