Original code without the cast:
ArrayList<String> elements = new ArrayList<String>();
for (ListTreeNode pos : positions)
elements.add(pos.getElement());
In ListTreeNode:
public String getElement() {
return element;
}
Eclipse is telling me that it is an unchecked cast from String to String if I do:
elements.add((String)pos.getElement());
I put the cast in there because before that it was telling me that the method add(String) in the ArrayList is not applicable for the type (String). I don't get that?