Question: My advance method is not working, I need help rewriting it / * * * Move forward, so that the current element is now the
My advance method is not working, I need help rewriting it
Move forward, so that the current element is now the next element in
this sequence.
@param none
@precondition
isCurrent returns true.
@postcondition
If the current element was already the end element of this sequence
with nothing after it then there is no longer any current element.
Otherwise, the new element is the element immediately after the
original current element.
@exception IllegalStateException
Indicates that there is no current element, so
advance may not be called.
public void advance
assert wellFormed : "invariant wrong at start of advance;
ifisCurrent
throw new IllegalStateExceptionNo current element to Advance";
precursor cursor;
cursor cursor.next;
TODO: Implemented by student.
assert wellFormed : "invariant wrong at end of advance;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
