public class C1 implements Iterable {
private LinkedList list;
public static class NC1 {
…
}
…
x public Iterator 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. Can someone help?
You need to change
NC1toC1.NC1. The following compiles:Alternatively, you could
import static yourpackage.C1.NC1.