Here you can find the source of compareCollections(Collection cola, Collection colb)
public static boolean compareCollections(Collection cola, Collection colb)
//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; } }