Here you can find the source of subtract(final Collection
public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b)
//package com.java2s; /**// ww w .j a v a 2 s . c om * Copyright (c) 2005-2012 springside.org.cn * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; public class Main { public static <T> List<T> subtract(final Collection<T> a, final Collection<T> b) { ArrayList<T> list = new ArrayList<T>(a); for (Iterator it = b.iterator(); it.hasNext();) { list.remove(it.next()); } return list; } }