Siana Ivanova wrote:I want my method call Next I first printed two elements, the next call to method print three elements, the next call method again print two elements.
You don't have enough elements in it to do so, you need 2, 3, 2 = 7 elements. I see you have only 6.
Anyway, problem probably not there. Do you have clear and written somewhere requirements so we could have a look at?
I just read your original question, which I did not understand, and the latest - these do not match. Please try clearly define your problem.
I have a class, that receives a list of items and divide it into list. Is defined size - a list of how many items are displayed at once.
The class has method next(), that returns next few elements of the list. Is defined size - a list of how many items are displayed at once.