java util iterator but cannot import java.util.iterator
- by qwertzuiop13
Given this Code
import java.util.Iterator;
private static List<String> someList = new ArrayList<String>();
public static void main(String[] args) {
someList.add("monkey");
someList.add("donkey");
//Code works when I change Iterator to java.util.Iterator, but import
//is not possible?
for(Iterator<String> i = someList.iterator(); i.hasNext(); ) {
String item = i.next();
System.out.println(item);
}
}
I receive the error: The type Iterator is not generic; it cannot be parameterized with arguments
Eclipse tells me that the import java.util.iterator conflicts with a type defined in the same file. lol... ?