Question: I am having trouble. please help me. Add iterator support to MyArrayList by following the steps below, - Create the class MyArrayListlterator , which implements

 I am having trouble. please help me. Add iterator support to

I am having trouble. please help me.

Add iterator support to MyArrayList by following the steps below, - Create the class MyArrayListlterator , which implements the Iterator interface. - MyArrayListlterator should contain the following data items, - "list" of type MyArrayList - "currentIndex" of type int, initially at zero - Make MyArrayList implement the Iterable interface by adding the iterator() method, which should return an instance of MyArrayListiterator. - Add the hasNext() and next() methods in MyArrayListlterator. - The hasNext() method should return true as long as currentIndex is less than the list size - The next() method should return the list's data item at index "currentIndex", and increment currentIndex You will have to fill in some of the blanks, such as handling exceptions and initializing the "list" member of MyArrayListlterator. Test it by creating an instance of MyArrayList, adding data to it, and using the enhanced for-loop to iterate through it and print out each data item. Turn in the following, - The source files (no zip file, just the individual .java files). - A screen shot of your program in action. It should show the result of the test run

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!