Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { public static Collection<Object> filterCollection(Collection<Object> src, Collection<Object> dest) { if (isEmpty(dest)) return src; Iterator<Object> iterator = src.iterator(); while (iterator.hasNext()) { Object next = iterator.next(); if (dest.contains(next)) { iterator.remove(); } } return src; } public static boolean isEmpty(Collection<?> collection) { if (null == collection || collection.isEmpty() || collection.size() <= 0) return true; return false; } public static boolean isEmpty(Map<?, ?> map) { if (null == map || map.isEmpty() || map.size() <= 0) return true; return false; } }