class CollectionHelper {

    public static <T> int remove(Iterable<T> iterable, Predicate<? super T> filter) {
        Validate.notNull(iterable, "iterable must not be null");
        Validate.notNull(filter, "filter must not be null");

        int removed = 0;
        Iterator<T> iterator = iterable.iterator();
        while (iterator.hasNext()) {
            T item = iterator.next();
            if (!filter.test(item)) {
                iterator.remove();
                removed++;
            }
        }
        return removed;
    }

    private  CollectionHelper();

}