Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.Collection; public class Main { private static <T> boolean removeAllFromArrayList(ArrayList<T> collection, Collection<?> toRemove) { boolean result = false; for (int i = collection.size(); --i >= 0;) if (toRemove.contains(collection.get(i))) { collection.remove(i); result = true; } return result; } }