Java tutorial
//package com.java2s; //License from project: Apache License import java.util.Collection; public class Main { public static <E> boolean removeAllIfNotNull(final Collection<? super E> collection, final Collection<? extends E> c) { return (collection != null) && (c != null) && collection.removeAll(c); } }