{"action":"created","comment":{"url":"https://api.github.com/repos/reactor/reactor-core/pulls/comments/108390986","pull_request_review_id":29417021,"id":108390986,"diff_hunk":"@@ -0,0 +1,51 @@\n+/*\n+ * Copyright (c) 2011-2017 Pivotal Software Inc, All Rights Reserved.\n+ *\n+ * Licensed under the Apache License, Version 2.0 (the \"License\");\n+ * you may not use this file except in compliance with the License.\n+ * You may obtain a copy of the License at\n+ *\n+ *        http://www.apache.org/licenses/LICENSE-2.0\n+ *\n+ * Unless required by applicable law or agreed to in writing, software\n+ * distributed under the License is distributed on an \"AS IS\" BASIS,\n+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ * See the License for the specific language governing permissions and\n+ * limitations under the License.\n+ */\n+\n+package reactor.core.publisher;\n+\n+import java.util.function.Function;\n+\n+import org.reactivestreams.Publisher;\n+import org.reactivestreams.Subscriber;\n+import reactor.util.concurrent.QueueSupplier;\n+\n+/**\n+ * Maps the first upstream value into a single {@code true} or {@code false} value\n+ * provided by a generated Publisher for that input value and emits the input value if\n+ * the inner Publisher returned {@code true}.\n+ * <p>\n+ * Only the first item emitted by the inner Publisher's are considered. If\n+ * the inner Publisher is empty, no resulting item is generated for that input value.\n+ *\n+ * @param <T> the input value type\n+ * @author Simon Baslé\n+ */\n+class MonoFilterWhen<T> extends MonoSource<T, T> {\n+\n+\tfinal Function<? super T, ? extends Publisher<Boolean>> asyncPredicate;\n+\n+\tMonoFilterWhen(Publisher<T> source,\n+\t\t\tFunction<? super T, ? extends Publisher<Boolean>> asyncPredicate) {\n+\t\tsuper(source);\n+\t\tthis.asyncPredicate = asyncPredicate;\n+\t}\n+\n+\t@Override\n+\tpublic void subscribe(Subscriber<? super T> s) {\n+\t\tsource.subscribe(new FluxFilterWhen.FilterWhenSubscriber<>(s,","path":"src/main/java/reactor/core/publisher/MonoFilterWhen.java","position":48,"original_position":48,"commit_id":"be1cbc0b003bc10b690aa37e3c0958b10e99a3d7","original_commit_id":"be1cbc0b003bc10b690aa37e3c0958b10e99a3d7","user":{"login":"simonbasle","id":6986166,"avatar_url":"https://avatars3.githubusercontent.com/u/6986166?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbasle","html_url":"https://github.com/simonbasle","followers_url":"https://api.github.com/users/simonbasle/followers","following_url":"https://api.github.com/users/simonbasle/following{/other_user}","gists_url":"https://api.github.com/users/simonbasle/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbasle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbasle/subscriptions","organizations_url":"https://api.github.com/users/simonbasle/orgs","repos_url":"https://api.github.com/users/simonbasle/repos","events_url":"https://api.github.com/users/simonbasle/events{/privacy}","received_events_url":"https://api.github.com/users/simonbasle/received_events","type":"User","site_admin":false},"body":"Indeed wasteful! Thanks for the pointers I'll rework a mono specific implementation ","created_at":"2017-03-28T10:55:38Z","updated_at":"2017-03-28T10:55:38Z","html_url":"https://github.com/reactor/reactor-core/pull/501#discussion_r108390986","pull_request_url":"https://api.github.com/repos/reactor/reactor-core/pulls/501","_links":{"self":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/comments/108390986"},"html":{"href":"https://github.com/reactor/reactor-core/pull/501#discussion_r108390986"},"pull_request":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/501"}}},"pull_request":{"url":"https://api.github.com/repos/reactor/reactor-core/pulls/501","id":112059069,"html_url":"https://github.com/reactor/reactor-core/pull/501","diff_url":"https://github.com/reactor/reactor-core/pull/501.diff","patch_url":"https://github.com/reactor/reactor-core/pull/501.patch","issue_url":"https://api.github.com/repos/reactor/reactor-core/issues/501","number":501,"state":"open","locked":false,"title":"fix #498 Add filterWhen operator","user":{"login":"simonbasle","id":6986166,"avatar_url":"https://avatars3.githubusercontent.com/u/6986166?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbasle","html_url":"https://github.com/simonbasle","followers_url":"https://api.github.com/users/simonbasle/followers","following_url":"https://api.github.com/users/simonbasle/following{/other_user}","gists_url":"https://api.github.com/users/simonbasle/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbasle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbasle/subscriptions","organizations_url":"https://api.github.com/users/simonbasle/orgs","repos_url":"https://api.github.com/users/simonbasle/repos","events_url":"https://api.github.com/users/simonbasle/events{/privacy}","received_events_url":"https://api.github.com/users/simonbasle/received_events","type":"User","site_admin":false},"body":"WIP. Done for Flux (+tests), need to expose in Mono + javadoc + possibly make it extends the `FluxOperatorTest` tck.","created_at":"2017-03-22T16:53:17Z","updated_at":"2017-03-28T10:55:38Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fb4e4961d3adbe28c8db5975589b944443b51bcc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/reactor/reactor-core/pulls/501/commits","review_comments_url":"https://api.github.com/repos/reactor/reactor-core/pulls/501/comments","review_comment_url":"https://api.github.com/repos/reactor/reactor-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/reactor/reactor-core/issues/501/comments","statuses_url":"https://api.github.com/repos/reactor/reactor-core/statuses/be1cbc0b003bc10b690aa37e3c0958b10e99a3d7","head":{"label":"reactor:498-filterWhen","ref":"498-filterWhen","sha":"be1cbc0b003bc10b690aa37e3c0958b10e99a3d7","user":{"login":"reactor","id":4201559,"avatar_url":"https://avatars0.githubusercontent.com/u/4201559?v=3","gravatar_id":"","url":"https://api.github.com/users/reactor","html_url":"https://github.com/reactor","followers_url":"https://api.github.com/users/reactor/followers","following_url":"https://api.github.com/users/reactor/following{/other_user}","gists_url":"https://api.github.com/users/reactor/gists{/gist_id}","starred_url":"https://api.github.com/users/reactor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactor/subscriptions","organizations_url":"https://api.github.com/users/reactor/orgs","repos_url":"https://api.github.com/users/reactor/repos","events_url":"https://api.github.com/users/reactor/events{/privacy}","received_events_url":"https://api.github.com/users/reactor/received_events","type":"Organization","site_admin":false},"repo":{"id":45903621,"name":"reactor-core","full_name":"reactor/reactor-core","owner":{"login":"reactor","id":4201559,"avatar_url":"https://avatars0.githubusercontent.com/u/4201559?v=3","gravatar_id":"","url":"https://api.github.com/users/reactor","html_url":"https://github.com/reactor","followers_url":"https://api.github.com/users/reactor/followers","following_url":"https://api.github.com/users/reactor/following{/other_user}","gists_url":"https://api.github.com/users/reactor/gists{/gist_id}","starred_url":"https://api.github.com/users/reactor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactor/subscriptions","organizations_url":"https://api.github.com/users/reactor/orgs","repos_url":"https://api.github.com/users/reactor/repos","events_url":"https://api.github.com/users/reactor/events{/privacy}","received_events_url":"https://api.github.com/users/reactor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactor/reactor-core","description":"Non-Blocking Reactive Foundation for the JVM","fork":false,"url":"https://api.github.com/repos/reactor/reactor-core","forks_url":"https://api.github.com/repos/reactor/reactor-core/forks","keys_url":"https://api.github.com/repos/reactor/reactor-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactor/reactor-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactor/reactor-core/teams","hooks_url":"https://api.github.com/repos/reactor/reactor-core/hooks","issue_events_url":"https://api.github.com/repos/reactor/reactor-core/issues/events{/number}","events_url":"https://api.github.com/repos/reactor/reactor-core/events","assignees_url":"https://api.github.com/repos/reactor/reactor-core/assignees{/user}","branches_url":"https://api.github.com/repos/reactor/reactor-core/branches{/branch}","tags_url":"https://api.github.com/repos/reactor/reactor-core/tags","blobs_url":"https://api.github.com/repos/reactor/reactor-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactor/reactor-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactor/reactor-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactor/reactor-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactor/reactor-core/statuses/{sha}","languages_url":"https://api.github.com/repos/reactor/reactor-core/languages","stargazers_url":"https://api.github.com/repos/reactor/reactor-core/stargazers","contributors_url":"https://api.github.com/repos/reactor/reactor-core/contributors","subscribers_url":"https://api.github.com/repos/reactor/reactor-core/subscribers","subscription_url":"https://api.github.com/repos/reactor/reactor-core/subscription","commits_url":"https://api.github.com/repos/reactor/reactor-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactor/reactor-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactor/reactor-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactor/reactor-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactor/reactor-core/contents/{+path}","compare_url":"https://api.github.com/repos/reactor/reactor-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactor/reactor-core/merges","archive_url":"https://api.github.com/repos/reactor/reactor-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactor/reactor-core/downloads","issues_url":"https://api.github.com/repos/reactor/reactor-core/issues{/number}","pulls_url":"https://api.github.com/repos/reactor/reactor-core/pulls{/number}","milestones_url":"https://api.github.com/repos/reactor/reactor-core/milestones{/number}","notifications_url":"https://api.github.com/repos/reactor/reactor-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactor/reactor-core/labels{/name}","releases_url":"https://api.github.com/repos/reactor/reactor-core/releases{/id}","deployments_url":"https://api.github.com/repos/reactor/reactor-core/deployments","created_at":"2015-11-10T10:06:40Z","updated_at":"2017-03-28T09:54:01Z","pushed_at":"2017-03-27T16:00:41Z","git_url":"git://github.com/reactor/reactor-core.git","ssh_url":"git@github.com:reactor/reactor-core.git","clone_url":"https://github.com/reactor/reactor-core.git","svn_url":"https://github.com/reactor/reactor-core","homepage":"http://projectreactor.io","size":37982,"stargazers_count":586,"watchers_count":586,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":45,"forks":93,"open_issues":45,"watchers":586,"default_branch":"master"}},"base":{"label":"reactor:master","ref":"master","sha":"de15bc6f76342a1a1715ec94e16d63a8f787f973","user":{"login":"reactor","id":4201559,"avatar_url":"https://avatars0.githubusercontent.com/u/4201559?v=3","gravatar_id":"","url":"https://api.github.com/users/reactor","html_url":"https://github.com/reactor","followers_url":"https://api.github.com/users/reactor/followers","following_url":"https://api.github.com/users/reactor/following{/other_user}","gists_url":"https://api.github.com/users/reactor/gists{/gist_id}","starred_url":"https://api.github.com/users/reactor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactor/subscriptions","organizations_url":"https://api.github.com/users/reactor/orgs","repos_url":"https://api.github.com/users/reactor/repos","events_url":"https://api.github.com/users/reactor/events{/privacy}","received_events_url":"https://api.github.com/users/reactor/received_events","type":"Organization","site_admin":false},"repo":{"id":45903621,"name":"reactor-core","full_name":"reactor/reactor-core","owner":{"login":"reactor","id":4201559,"avatar_url":"https://avatars0.githubusercontent.com/u/4201559?v=3","gravatar_id":"","url":"https://api.github.com/users/reactor","html_url":"https://github.com/reactor","followers_url":"https://api.github.com/users/reactor/followers","following_url":"https://api.github.com/users/reactor/following{/other_user}","gists_url":"https://api.github.com/users/reactor/gists{/gist_id}","starred_url":"https://api.github.com/users/reactor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reactor/subscriptions","organizations_url":"https://api.github.com/users/reactor/orgs","repos_url":"https://api.github.com/users/reactor/repos","events_url":"https://api.github.com/users/reactor/events{/privacy}","received_events_url":"https://api.github.com/users/reactor/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/reactor/reactor-core","description":"Non-Blocking Reactive Foundation for the JVM","fork":false,"url":"https://api.github.com/repos/reactor/reactor-core","forks_url":"https://api.github.com/repos/reactor/reactor-core/forks","keys_url":"https://api.github.com/repos/reactor/reactor-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reactor/reactor-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reactor/reactor-core/teams","hooks_url":"https://api.github.com/repos/reactor/reactor-core/hooks","issue_events_url":"https://api.github.com/repos/reactor/reactor-core/issues/events{/number}","events_url":"https://api.github.com/repos/reactor/reactor-core/events","assignees_url":"https://api.github.com/repos/reactor/reactor-core/assignees{/user}","branches_url":"https://api.github.com/repos/reactor/reactor-core/branches{/branch}","tags_url":"https://api.github.com/repos/reactor/reactor-core/tags","blobs_url":"https://api.github.com/repos/reactor/reactor-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reactor/reactor-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reactor/reactor-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/reactor/reactor-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reactor/reactor-core/statuses/{sha}","languages_url":"https://api.github.com/repos/reactor/reactor-core/languages","stargazers_url":"https://api.github.com/repos/reactor/reactor-core/stargazers","contributors_url":"https://api.github.com/repos/reactor/reactor-core/contributors","subscribers_url":"https://api.github.com/repos/reactor/reactor-core/subscribers","subscription_url":"https://api.github.com/repos/reactor/reactor-core/subscription","commits_url":"https://api.github.com/repos/reactor/reactor-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/reactor/reactor-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/reactor/reactor-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/reactor/reactor-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/reactor/reactor-core/contents/{+path}","compare_url":"https://api.github.com/repos/reactor/reactor-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reactor/reactor-core/merges","archive_url":"https://api.github.com/repos/reactor/reactor-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reactor/reactor-core/downloads","issues_url":"https://api.github.com/repos/reactor/reactor-core/issues{/number}","pulls_url":"https://api.github.com/repos/reactor/reactor-core/pulls{/number}","milestones_url":"https://api.github.com/repos/reactor/reactor-core/milestones{/number}","notifications_url":"https://api.github.com/repos/reactor/reactor-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reactor/reactor-core/labels{/name}","releases_url":"https://api.github.com/repos/reactor/reactor-core/releases{/id}","deployments_url":"https://api.github.com/repos/reactor/reactor-core/deployments","created_at":"2015-11-10T10:06:40Z","updated_at":"2017-03-28T09:54:01Z","pushed_at":"2017-03-27T16:00:41Z","git_url":"git://github.com/reactor/reactor-core.git","ssh_url":"git@github.com:reactor/reactor-core.git","clone_url":"https://github.com/reactor/reactor-core.git","svn_url":"https://github.com/reactor/reactor-core","homepage":"http://projectreactor.io","size":37982,"stargazers_count":586,"watchers_count":586,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":45,"forks":93,"open_issues":45,"watchers":586,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/501"},"html":{"href":"https://github.com/reactor/reactor-core/pull/501"},"issue":{"href":"https://api.github.com/repos/reactor/reactor-core/issues/501"},"comments":{"href":"https://api.github.com/repos/reactor/reactor-core/issues/501/comments"},"review_comments":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/501/comments"},"review_comment":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/reactor/reactor-core/pulls/501/commits"},"statuses":{"href":"https://api.github.com/repos/reactor/reactor-core/statuses/be1cbc0b003bc10b690aa37e3c0958b10e99a3d7"}}}}
{"actor":{"display_login":"simonbasle"}}