Here you can find the source of removeAll(Collection
public static <T> List<T> removeAll(Collection<T> collection, Collection<T> remove)
//package com.java2s; //License from project: Apache 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> removeAll(Collection<T> collection, Collection<T> remove) { List<T> list = new ArrayList<T>(); for (Iterator<T> iter = collection.iterator(); iter.hasNext();) { T obj = iter.next();/*from w ww . ja v a 2s . c o m*/ if (remove.contains(obj) == false) { list.add(obj); } } return list; } }