I'm creating a generic class SortedArray that implements Iterable. My big problem is that I'm lost as to what I need to return for this particular method, or for that matter if I'm missing a major step in implementing it. With this current code when I compile it in Unix I'm getting an error stating inconvertible types. Any feedback or information that could put me on my way to fixing this would be much appreciated. Thank you.
public class SortedArray< T extends Comparable< T > >
extends Object
implements Iterable < T > {
private T[] internalArray;
public Iterator<T> iterator() {
return (Iterator<T>) Arrays.asList(internalArray).iterator();
}
}