Java tutorial
//package com.java2s; import java.util.Collection; import java.util.Iterator; public class Main { public static void removeItemFromCollectionByUsingIteratorRemoveMethod(Collection<String> collection, String elementToBeRemoved) { Iterator iterator = collection.iterator(); while (iterator.hasNext()) { String element = (String) iterator.next(); if (element.equals(elementToBeRemoved)) { iterator.remove(); } } } }