<p>I have a bunch of generic interfaces and classes</p>

<pre><code>public interface IElement {
// omited
}

class Element implements IElement {
// omited
}

public interface IElementList&lt;E extends IElement&gt;  extends Iterable {
   public Iterator&lt;E&gt; iterator();
}

class ElementList implements IElementList&lt;Element&gt; {

    public Iterator&lt;Element&gt; iterator() {
       // omited
       }
}


public interface IElementListGroup&lt;E extends IElementList&lt;? extends IElement&gt;&gt; {
    public E getChosenElementList();
}


class ElementListGroup implements IElementListGroup&lt;ElementList&gt; {
    public ElementList getChosenElementList() {
        // omited
    }
}
</code></pre>

<p>And then a simple code</p>

<pre><code>ElementListGroup group;

for(Element e : group.getChosenElementList())
{
 // omited
}
</code></pre>

<p>And the line with for keyword throwe a "cannot convert from element type Object to Element" compiler error.</p>

<p>Thanks in advance.</p>

```
IElementList
```
needs to implement
```
Iterable<E>
```
. Otherwise, the interface specifies
```
Iterator iterator()
```
, not
```
Iterator<E> iterator()
```
. This makes the compiler think that you're iterating over
```
Object
```
s.
I made this change, and it compiled fine (after adding some null returns).