Creating my own List interfaces - How to implement Iterator method?
Alright so for class we need to create our own versions of an ArrayList and double-linked-list, stack and queue.
We have a List ADT that we are using and one of the methods we need to implement is an Iterator.
The method looks like this:
public Iterator iterator()
{
}
But I have no idea what exactly I'm supposed to put in there. From what I can see Iterator is an interface itself in the API and it has its own methods.
So I guess all I want to do is make an iterator from my array and just return it.
Well this is what I tried:
public Iterator iterator()
{
iterator = array.iterator();
return iterator;
}
But that doesn't work, it keeps wanting to change everything to static.
If anyone knows how to go about doing this it'd be a huge help.

