Here you can find the source of minus(Collection toBeDeletedFrom, Collection tobeDeleted)
public static Collection minus(Collection toBeDeletedFrom, Collection tobeDeleted)
//package com.java2s; /*L// w ww . j a v a 2 s . c o m * Copyright Ekagra Software Technologies Ltd. * Copyright SAIC, SAIC-Frederick * * Distributed under the OSI-approved BSD 3-Clause License. * See http://ncip.github.com/common-security-module/LICENSE.txt for details. */ import java.util.*; public class Main { public static Collection minus(Collection toBeDeletedFrom, Collection tobeDeleted) { ArrayList result = new ArrayList(toBeDeletedFrom); Iterator it = tobeDeleted.iterator(); while (it.hasNext()) { Object oj = it.next(); if (toBeDeletedFrom.contains(oj)) { result.remove(oj); } } return result; } }