I called a getElements method which returns Iterable.
getElements
Iterable
I did this:
List elements = (List
you can try to place a guard with instanceof:
instanceof
if (AnElement instanceof AList){ //cast AList = (AnList)Element }