i'm trying to develop an e4 application but i have an error : in this part "error:Type mismatch: cannot convert from element type Object to Parent" any help please thanks in advance :)
@Creatable
@Singleton
public class TreeControl {
ParentsHolder parentholder = new ParentsHolder();
public Parent parentExists(String str) {
for (Parent p : parentholder.getParents())
if (p.getTag().equals(str))
return p;
return null;
}
public Child childExists(String p, String c) {
Parent parent = parentExists(p);
if (parent != null)
for (Child child : parent.getChildren())
if (child.getTag().equals(c))
return child;
return null;
}
}
this is Parent Holder class
public class ParentsHolder extends Model {
List parents = new ArrayList();
public List getParents() {
return parents;
}
public void setParents(List parents) {
firePropertyChange("parents", this.parents, this.parents = parents);
}
public void addParent(Parent p) {
List newlist = new ArrayList<>(parents);
newlist.add(p);
setParents(newlist);
}
}
and the error is in this line
for (Parent p : parentholder.getParents())
and this line:
for (Child child : parent.getChildren())