Skip to content

4.x: Add Streamable collectInto operator - #8397

Merged
akarnokd merged 1 commit into
ReactiveX:4.xfrom
jimi-21:feat/streamable-collect-into
Nov 17, 2026
Merged

akarnokd merged 1 commit into
ReactiveX:4.xfrom
jimi-21:feat/streamable-collect-into

Conversation

@jimi-21

@jimi-21 jimi-21 commented Nov 17, 2026

Copy link
Copy Markdown
Contributor

Related #8299.

Summary

Add Streamable.collectInto() with Single<U> as its result type.

The implementation checks initialItem eagerly, then composes the existing collect(() -> initialItem, collector) and lastOrError() operators. The collector receives the mutable container and each upstream item, matching the corresponding Flowable.collectInto contract.

Tests

Added StreamableCollectIntoTest for:

  • collecting multiple items in encounter order;
  • returning the initial container for an empty source;
  • propagating an upstream error;
  • rejecting null initialItem and collector arguments.

Test-first evidence: before the method was added, the new test class failed compilation with five missing-method errors.

The final focused run on Zulu JDK 26 covers StreamableCollectIntoTest, StreamableCountTest, and CheckParamValidationNamingTest.checkStreamable: 10 tests, 0 failures/errors, 2 existing skips. checkstyleMain and checkstyleTest pass. The full suite was not run for this focused addition.

AI disclosure: Kimi Code assisted with API analysis, implementation, tests, local verification, and this PR description. The failing-before compilation result, generic type adjustments, final test results, and two-file diff were checked.

@github-actions

Copy link
Copy Markdown

🐷 TruffleHog + Entropy Beauty Scan

Average entropy of changed code: 4.786 bits/char
Verdict: ⚠️ Consider review — entropy outside sweet spot

Changed files entropy:

src/main/java/io/reactivex/rxjava4/core/Streamable.java: 4.662
src/test/java/io/reactivex/rxjava4/internal/operators/streamable/StreamableCollectIntoTest.java: 4.910

✅ No secrets or suspicious high-entropy strings found.

Mid-4 beauty heuristic in action — powered by our entropy chats! 😊

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.62%. Comparing base (dea167e) to head (1194ac0).
⚠️ Report is 1 commits behind head on 4.x.

Additional details and impacted files
@@             Coverage Diff              @@
##                4.x    #8397      +/-   ##
============================================
- Coverage     98.64%   98.62%   -0.02%     
+ Complexity     7181     7180       -1     
============================================
  Files           826      826              
  Lines         51036    51038       +2     
  Branches       6944     6944              
============================================
- Hits          50342    50335       -7     
- Misses          473      482       +9     
  Partials        221      221              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@akarnokd
akarnokd merged commit ca68c46 into ReactiveX:4.x Nov 17, 2026
8 checks passed
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.

2 participants