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

chunkBy #33

Merged
merged 5 commits into from
Mar 6, 2016
Merged

chunkBy #33

merged 5 commits into from
Mar 6, 2016

Conversation

solderra
Copy link
Contributor

@solderra solderra commented Mar 5, 2016

added chunkBy() method + test case

The chunkBy() method partitions the Stream into Lists according to the given classifier function. In contrast to groupBy(), this method assumes that the elements of the stream are sorted. Because of this assumption, it does not need to first collect all elements and then partition them. Instead, it can emit a List of elements when it reaches the first element that does not belong to the same chunk as the previous elements.

This is useful, for example, to process datasets from a database as they are usually sorted by time or some other criteria.

Signed-off-by: solderra <solderra@gmail.com>
…m-API into chunkBy

Signed-off-by: solderra <solderra@gmail.com>

Conflicts:
	src/main/java/com/annimon/stream/Stream.java
aNNiMON added a commit that referenced this pull request Mar 6, 2016
@aNNiMON aNNiMON merged commit c75320c into aNNiMON:master Mar 6, 2016
@solderra solderra deleted the chunkBy branch March 6, 2016 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants