Koloboke icon indicating copy to clipboard operation
Koloboke copied to clipboard

re-settable Iterator or Cursor

Open sortakool opened this issue 9 years ago • 1 comments

I'm not sure If I'm missing something. But I would like to get access to either an iterator or Cursor to loop over elements of a collection without it internally creating a new instance of an Iterator or Cursor (such as NoRemovedIterator or NoRemovedCursor).

One way I imagine doing this is creating the Iterator or Cursor at initialization and then resetting it every time I need to loop over the elements.

I don't want to use the for each lambdas as I have other variables needed for iteration that would also potentially cause a new lambda instance to be created.

sortakool avatar Mar 16 '15 19:03 sortakool

I found a workaround. I created a subclass of Consumer that has mutable properties and I reset its state before I call forEach(Consumer)

sortakool avatar Mar 16 '15 21:03 sortakool