I called a getElements method which returns Iterable.
getElements
Iterable
I did this:
List elements = (List
Not all Iterables are Lists, thus it's not safe to cast an arbitrary Iterable to a List.
List
Take any Set for instance, a HashSet is Iterable but the elements has no order, so it can't implement the List interface, and is thus not a List.
Set
HashSet