Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Collection; public class Main { public static boolean isTheSame(Collection a, Collection b) { int sizeA = a == null ? 0 : a.size(); int sizeB = b == null ? 0 : b.size(); if (sizeA == sizeB && sizeA != 0) { int matchCount = 0; for (Object obj : a) { if (b.contains(obj)) { matchCount++; } } return matchCount == b.size(); } else { return sizeA == 0; } } }