Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

re-settable Iterator or Cursor #38

Open
sortakool opened this issue Mar 16, 2015 · 1 comment
Open

re-settable Iterator or Cursor #38

sortakool opened this issue Mar 16, 2015 · 1 comment

Comments

@sortakool
Copy link

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants