{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3744","repository_url":"https://api.github.com/repos/ReactiveX/RxJava","labels_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3744/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3744/comments","events_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3744/events","html_url":"https://github.com/ReactiveX/RxJava/pull/3744","id":139576248,"number":3744,"title":"1.x: new operators buffer(While/Until) with predicate-based boundary","user":{"login":"akarnokd","id":1269832,"avatar_url":"https://avatars.githubusercontent.com/u/1269832?v=3","gravatar_id":"","url":"https://api.github.com/users/akarnokd","html_url":"https://github.com/akarnokd","followers_url":"https://api.github.com/users/akarnokd/followers","following_url":"https://api.github.com/users/akarnokd/following{/other_user}","gists_url":"https://api.github.com/users/akarnokd/gists{/gist_id}","starred_url":"https://api.github.com/users/akarnokd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/akarnokd/subscriptions","organizations_url":"https://api.github.com/users/akarnokd/orgs","repos_url":"https://api.github.com/users/akarnokd/repos","events_url":"https://api.github.com/users/akarnokd/events{/privacy}","received_events_url":"https://api.github.com/users/akarnokd/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ReactiveX/RxJava/labels/Discussion","name":"Discussion","color":"5319e7"},{"url":"https://api.github.com/repos/ReactiveX/RxJava/labels/Enhancement","name":"Enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2016-03-09T13:25:20Z","updated_at":"2016-03-11T18:13:31Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ReactiveX/RxJava/pulls/3744","html_url":"https://github.com/ReactiveX/RxJava/pull/3744","diff_url":"https://github.com/ReactiveX/RxJava/pull/3744.diff","patch_url":"https://github.com/ReactiveX/RxJava/pull/3744.patch"},"body":"The need for a buffer operator that splits the source sequence into continuous non-overlapping buffers based on the values in the sequence comes up from time to time. For, me, it reached the point where I'd consider adding operator(s) with this functionality into RxJava.\r\n\r\nThere are two variants of the required functionality: split before the element is added to the buffer: `bufferWhile`; and split after the element has been added to the buffer: `bufferUntil`.  Both cases, the predicate has to return `true` to trigger a split and emission of the current buffer.\r\n\r\nI've added 2-2 overloads of these methods to `Observable` where the second overloads allow specifying the expected capacity use of the buffers (for performance reasons). These operators don't support backpressure and go unbounded, just like `buffer(Observable)` and others.\r\n\r\nIn the operator itself, I've added backpressured versions of `bufferWhile` and `bufferUntil`, which use a prefetch queue and a request-dependent queue-drain approach. It is up for a discussion what to do with these (provided this PR is of interest at all): 1) use them as the basis for the methods instead, 2) expose them through a different name and 3) drop them.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/comments/195483658","html_url":"https://github.com/ReactiveX/RxJava/pull/3744#issuecomment-195483658","issue_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3744","id":195483658,"user":{"login":"stevegury","id":376195,"avatar_url":"https://avatars.githubusercontent.com/u/376195?v=3","gravatar_id":"","url":"https://api.github.com/users/stevegury","html_url":"https://github.com/stevegury","followers_url":"https://api.github.com/users/stevegury/followers","following_url":"https://api.github.com/users/stevegury/following{/other_user}","gists_url":"https://api.github.com/users/stevegury/gists{/gist_id}","starred_url":"https://api.github.com/users/stevegury/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevegury/subscriptions","organizations_url":"https://api.github.com/users/stevegury/orgs","repos_url":"https://api.github.com/users/stevegury/repos","events_url":"https://api.github.com/users/stevegury/events{/privacy}","received_events_url":"https://api.github.com/users/stevegury/received_events","type":"User","site_admin":false},"created_at":"2016-03-11T18:13:31Z","updated_at":"2016-03-11T18:13:31Z","body":":+1: \r\nI also noticed recently that `testErrorThrownIssue1685` started failing more frequently on TravisCI."}}