Segment 17.3 considered three ways to avoid the pitfall of a sorted list inheriting the add-by-position and replace by position operations from the ADT list. Revise the class SortedList that Segment 17.1 describes by overriding add and replace and changing their behaviors as follows:
/** Adds newEntry to this sorted list in its correct sorted order, ignoring the
value of newPosition. */
public void add(int newPosition, T newEntry);
/** Removes the entry at givenPosition from this sorted list and
then adds newEntry in its correct sorted order. */
public T replace(int givenPosition, T newEntry);
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.