List of utility methods to do Collection Subtract
ArrayList | subtract(Collection subtract ArrayList<T> al = new ArrayList<T>(); al.addAll(l1); for (T item : l2) { al.remove(item); return al; |
Collection | subtract(final Collection a, final Collection b) Returns a new Collection containing a - b. ArrayList list = new ArrayList(a); for (Iterator it = b.iterator(); it.hasNext();) { list.remove(it.next()); return list; |
Collection | subtract(final Collection subtract ArrayList<K> list = new ArrayList<K>(a); for (Iterator<K> it = b.iterator(); it.hasNext();) { list.remove(it.next()); return list; |
List | subtract(final Collection subtract ArrayList<T> list = new ArrayList<T>(a); for (Iterator it = b.iterator(); it.hasNext();) { list.remove(it.next()); return list; |
List | subtract(final Collection subtract List<T> list = new ArrayList<T>(a); for (T element : b) { list.remove(element); return list; |
Collection | subtractCollections(Collection extends T> collection1, Collection extends T> collection2) Returns all items in collection1 that are not in collection2 Collection<T> result = new ArrayList<T>(collection1); result.removeAll(collection2); return result; |