CodeGym /Courses /Java Collections /Tasks | Level 7 | Lesson 4

Tasks | Level 7 | Lesson 4

Java Collections
Level 7 , Lesson 4
Available

"Hi, buddy. Here's an interesting task for you."

18
Task
Java Collections, level 7, lesson 4
Locked
Circular iterator
The Solution class inherits ArrayList. Properly override the iterator method in the Solution class. Write your own CircularIterator class inside the Solution class. It will be an iterator for the Solution list. The iterator must move circularly through all of the elements.

"Wait, I'm getting a call"

"Hello? Uh-huh... Yes... Factory... What about this factory??? Hello? Hello?"

"Amigo, the captain called and said something about some factory and a secret agent. You're my friend, right? Go to this Agent IntelliJ IDEA and find out what's up with the factory. But, shh! Don't tell anyone."

"Yes, I know the secret agent. We've spent many hours together. Don't worry. I'm already on my way."

Comments (4)
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION
UltraGameCoder Level 41, Groningen, Netherlands
5 September 2022
What are we supposed to find in the IDEA plugin? Nothing seems available after completing the task?
Lisa Level 41
27 January 2022
If you use reflection to be able to access the ArrayLists inner class Itr and that way are able to modify the cursor field, then this task is kinda easy ;) hasNext and remove, just delegate. The next method, here you get the desired return value using delegation and then check if hasNext returns false. Then call set on the cursor field and set it to 0. That's all Or, if reflection isn't your thing, just copy over the code from Itr to your CircularIterator
Tom Level 41, San Jose, Sweden
2 June 2021
hard one!
Denys Level 41, Ukraine
10 April 2021
Implement ALL these methods to avoid timeouts: remove, next, hasNext. Use the Decorator pattern to solve this task