Why is an array not assignable to Iterable?
The array is an Object, but its items might not be. The array might hold a primitive type like int, which Iterable can't cope with. At least that's what I reckon.
Arrays can implement interfaces (Cloneable
and java.io.Serializable
). So why not Iterable
? I guess Iterable
forces adding an iterator
method, and arrays don't implement methods. char[]
doesn't even override toString
. Anyway, arrays of references should be considered less than ideal - use List
s. As dfa comments, Arrays.asList
will do the conversion for you, explicitly.
(Having said that, you can call clone
on arrays.)