Implementig Java Iterable<E> interface
        Posted  
        
            by Metz
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Metz
        
        
        
        Published on 2010-05-31T13:28:00Z
        Indexed on 
            2010/05/31
            13:33 UTC
        
        
        Read the original article
        Hit count: 332
        
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.
© Stack Overflow or respective owner