I called a getElements
method which returns Iterable
.
I did this:
List elements = (List
List
is a subinterface of Iterable
meaning that List includes pretty much everything that Iterable has, however not the other way around. So not all methods in a List instance would have an equivalent in Iterable.
Try to avoid that sort of casting.
I would recommend you to take a quick look at the Java 6 API and the tutorials covering casting