I have a bunch of generic interfaces and classes
public interface IElement {
// omited
}
class Element implements IElement {
// omited
}
public interface IElementList<E extends IElement> extends Iterable {
public Iterator<E> iterator();
}
class ElementList implements IElementList<Element> {
public Iterator<Element> iterator() {
// omited
}
}
public interface IElementListGroup<E extends IElementList<? extends IElement>> {
public E getChosenElementList();
}
class ElementListGroup implements IElementListGroup<ElementList> {
public ElementList getChosenElementList() {
// omited
}
}
And then a simple code
ElementListGroup group;
for(Element e : group.getChosenElementList())
{
// omited
}
And the line with for keyword throwe a "cannot convert from element type Object to Element" compiler error.
Thanks in advance.