0

Iterator

public static void removeEvenLength(List<String> list) { Iterator<String> itr= list.iterator(); while (itr.hasNext()) { String element=itr.next(); if (element.length()%2==0) { i.remove(); } } } // why is iterator object not created with ”new” keyword for list collection in java

30th Jul 2020, 2:05 PM
Zhengrong Yan
Zhengrong Yan - avatar
1 ответ