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

more robust slideby classifier function handling #2642

Merged
merged 1 commit into from
Apr 11, 2021

Conversation

jwbargsten
Copy link
Contributor

When the classifier function is pure everything works fine, but with
state, slideBy might end up in an infinite loop. The reason: slideBy
calls the classifier two times on the same item. If the second call
returns a different value, slideBy will not advance anymore and
iterate indefinitely on the same item.

When the classifier function is pure everything works fine, but with
state, `slideBy` might end up in an infinite loop. The reason: `slideBy`
calls the classifier two times on the same item. If the second call
returns a different value, `slideBy` will not advance anymore and
iterate indefinitely on the same item.
@codecov-io
Copy link

Codecov Report

Merging #2642 (df70103) into master (2fe9895) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #2642      +/-   ##
============================================
- Coverage     92.89%   92.87%   -0.02%     
  Complexity     5368     5368              
============================================
  Files            89       89              
  Lines         12785    12786       +1     
  Branches       1619     1619              
============================================
- Hits          11876    11875       -1     
- Misses          720      722       +2     
  Partials        189      189              
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/vavr/collection/Iterator.java 89.70% <100.00%> (+0.01%) 182.00 <0.00> (ø)
src/main/java/io/vavr/concurrent/FutureImpl.java 73.68% <0.00%> (-1.51%) 27.00% <0.00%> (ø%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2fe9895...df70103. Read the comment docs.

Copy link
Contributor

@danieldietrich danieldietrich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice finding! Sorry for the delay and many thanks!

@danieldietrich danieldietrich merged commit a09f8cc into vavr-io:master Apr 11, 2021
danieldietrich pushed a commit that referenced this pull request Jul 14, 2021
When the classifier function is pure everything works fine, but with
state, `slideBy` might end up in an infinite loop. The reason: `slideBy`
calls the classifier two times on the same item. If the second call
returns a different value, `slideBy` will not advance anymore and
iterate indefinitely on the same item.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants