Java Collection Compare compareCollections(Collection cola, Collection colb)

Here you can find the source of compareCollections(Collection cola, Collection colb)

Description

compare Collections

License

Open Source License

Declaration

public static boolean compareCollections(Collection cola,
            Collection colb) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    public static boolean compareCollections(Collection cola,
            Collection colb) {/*from  w ww.  j av  a2 s.  co  m*/
        if (cola.size() != colb.size())
            return false;
        Iterator ita = cola.iterator();
        Iterator itb = colb.iterator();
        while (ita.hasNext()) {
            Object itema = ita.next();
            Object itemb = itb.next();

            if (!itema.equals(itemb))
                return false;
        }
        return true;
    }
}

Related

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