How to remove an element from collection using Iterator?

indian dating culture in america Below example shows how to remove an element from collection object using Iterator object. The remove() method removes from the underlying collection the last element returned by the iterator

enter site package pack2; import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class RemoveElementIterator { public static void main(String a[]){ String removeElem = "Perl"; List<String> myList = new ArrayList<String>(); myList.add("Java"); myList.add("Unix"); myList.add("Oracle"); myList.add("C++"); myList.add("Perl"); System.out.println("Before remove:"); System.out.println(myList); Iterator<String> itr = myList.iterator(); while(itr.hasNext()){ if(removeElem.equals({ itr.remove(); } } System.out.println("After remove:"); System.out.println(myList); } }

follow url enter Output:

go to site

see url Before remove:
[Java, Unix, Oracle, C++, Perl]
After remove:
[Java, Unix, Oracle, C++] peliculas online gratis subtituladas en español para adultos KAIKKI UUDET JA VANHAT TERVETULOA TOIMINTAAN!

online dating falkirk christian singles dating site reviews