Cris Marinescu wrote:How can I replace my code from next() in order to have the right result?
You would have to ask somebody who knew what "Decrementing" means in "DecrementingCarousel". I looked at the code and there was no hint of that. My guess was that the "decrementing" was this code:
but only because there was decrementing going on there. Otherwise there was just code fossicking around in an array for no reason I could determine.
You may feel that I am being over-critical of your code. On the contrary, it's the documentation of the code that I'm criticizing. I see nothing which says what it's supposed to do, nor any comments in the code which say what it is actually doing.