Solidify iterable iteration.

Casting to Object[] will throw when a primitive array is used. Use the utilities provided by Array to iterate in a type-safe way.

@dnkoutso