I was trying some things and, unintentionally, I passed the task only by replacing
return new LocalIterator();
with
return new LocalIterator(){};
But I didn't "transfer the LocalIterator logic to an anonymous class", as how it was supposed to be. So I'm asking: what should be the correct solution? I didn't get the essence of this task, I have no idea, not even how to start.