Skip to main content

Timeline for Cyclic iterator in both directions

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Oct 27, 2014 at 15:46 vote accept django
Oct 27, 2014 at 15:14 comment added Flambino @django Yes, if you want. I'm not saying my code is the only way to do it, though.
Oct 27, 2014 at 15:12 comment added django so in your code i will use first getNext() and getPrevious() to move through items and use getCurrent() to get the current item.
Oct 27, 2014 at 15:08 comment added Flambino @django Sure, but getCurrent will return 1. Question is what you consider "next" and "previous" when you haven't actually done anything yet. If you want, you can replace it with your increment-after solution.
Oct 27, 2014 at 15:02 comment added django var a = [1,2,3,4]; var d = cyclicIterator(a); in your code d.getNext() returns 2.
Oct 27, 2014 at 14:47 history edited Flambino CC BY-SA 3.0
added 393 characters in body
Oct 27, 2014 at 14:42 history answered Flambino CC BY-SA 3.0