gauravkv gupta wrote: Please explain the "cond". What is meant by this?
The following method shows you how to use an Iterator to filter an arbitrary Collection — that is, traverse the collection removing specific elements. static void filter(Collection<?> c) { for (Iterator<?> it = c.iterator(); it.hasNext(); ) if (!cond(it.next())) it.remove(); }