Clarifications
- Regarding the MyIterator class:
- hasNext() - returns true if calling next() will return a value. For example, if the list has only one
element, and you just created the iterator, hasNext() should return true as calling next() will return the
first element in the list. Notice that hasNext() functionality could be confused with whether there is an element following
the current one; that is not the correct interpretation for the task associated with the method.
-
next() - should return the next value and set things up so that hasNext() can recognize whether there is
another element.
-
You can assume users will not call next() without first calling hasNext().
-
We should be able to call hasNext() as many times as we want without affecting what is considered to be the
next element. For example, for a list with three elements for which we just created an iterator, hasNext()
should return true. If we call hasNext() a second time, and then call next(), we should retrieve the first
value from the list.
- The PublicTest named "testListAdd" represents the Good Faith attempt for this project. This implies you must pass
this test.
- The MyIterator class is meant to be utilized by users of the MySortedLinkedList class, and you should not use it
to implement methods (e.g., size method, add, etc.)of the MySortedLinkedList class.
-
If you are having problems with your MySortedLinkedList class, try developing student tests based on a list of
integers or strings (rather than activities). For example, test whether you can insert all the permutations of three numbers
(e.g., 10, 20, 30) correctly. This is very important idea when developing code; simplify the data in order to test your code.
Web Accessibility