Implementig Java Iterable<E> interface
- by Metz
Hi, i wrote this code:
public class C1 implements Iterable<NC1> {
private LinkedList<NC1> list;
public static class NC1 {
...
}
...
x public Iterator<NC1> iterator() {
return list.iterator();
}
}
but eclipse whines (at the x-ed line):
- The return type is incompatible with Iterable<NC1>.iterator()
- implements java.lang.Iterable<NC1>.iterator
i don't understand where the mistake is.
thanks in advance.