ddanielr commented on PR #5341:
URL: https://github.com/apache/accumulo/pull/5341#issuecomment-2761497496

   > > When trying to write the javadoc seemed like `next()` was called 
`limit-1` times, so I changed the impl to call `next()` `limit` times. Those 
changes could be ignored.
   > 
   > Here's what I was trying to do, it's possible that I had an error in my 
logic.
   > 
   > `advanceTo` should use `peek` to test whether the next element matches the 
predicate. When `advanceTo` is called and returns true, then the next element 
should return the match. When `advanceTo` is called and returns false, then 
`limit` elements have been evaluated.
   > 
   > Given the following list:
   > 
   > ```
   > 1, 2, 3, 4, 5, 6, ...
   > ```
   > 
   > If my current element is `1`, and I want to search for `5` in the next two 
elements, then I have to:
   > 
   > 1. peek at `2` to see if it matches `5`
   > 2. call next to consume it and move forward
   > 3. peek at `3` to see if it matches `5`
   > 4. return false.
   > 
   > Also, maybe `advanceTo` is a bad name as maybe it implies that the 
iterator ends up at `current + limit`. Maybe `find` or `search` is a better 
name.
   
   `seekTo` and `advanceTo` seem to be analogous. I agree that `advanceTo` 
implies `current + limit`. 
   `limitedSearch` or `limitedFind` would better communicate the intent. 
   
   `positionAt` is another option but I think that something related to 
`search` or `find` is probably better.   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to