"Zhipeng Wang" [email protected] wrote:
Just struggling to return an object with the DoubleEndedIterator interface implemented...
Do I need to create a class implementing the interface first, then initiate an instance to return? Thank you.
To satisfy the signature of the method you are trying to implement, you must return an object that implements DoubleEndedIterator
. The only class in the provided code that implements this interface is RangeIterator
, which will not behave as required. So you must find a way to construct an object that implements that interface with the right behaviour. There are several ways to do this. You mention one: Creating your own class.
You should not be encountering this for the first time in Task 5. Are you sure you understand your solutions to the previous tasks?