{"action":"created","issue":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3931","repository_url":"https://api.github.com/repos/ReactiveX/RxJava","labels_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3931/labels{/name}","comments_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3931/comments","events_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3931/events","html_url":"https://github.com/ReactiveX/RxJava/pull/3931","id":154416771,"number":3931,"title":"1.x: add groupBy overload with evictingMapFactory","user":{"login":"davidmoten","id":318187,"avatar_url":"https://avatars.githubusercontent.com/u/318187?v=3","gravatar_id":"","url":"https://api.github.com/users/davidmoten","html_url":"https://github.com/davidmoten","followers_url":"https://api.github.com/users/davidmoten/followers","following_url":"https://api.github.com/users/davidmoten/following{/other_user}","gists_url":"https://api.github.com/users/davidmoten/gists{/gist_id}","starred_url":"https://api.github.com/users/davidmoten/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidmoten/subscriptions","organizations_url":"https://api.github.com/users/davidmoten/orgs","repos_url":"https://api.github.com/users/davidmoten/repos","events_url":"https://api.github.com/users/davidmoten/events{/privacy}","received_events_url":"https://api.github.com/users/davidmoten/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/ReactiveX/RxJava/labels/Feature-Request","name":"Feature-Request","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":20,"created_at":"2016-05-12T07:39:20Z","updated_at":"2016-06-25T09:47:43Z","closed_at":"2016-06-25T09:46:50Z","pull_request":{"url":"https://api.github.com/repos/ReactiveX/RxJava/pulls/3931","html_url":"https://github.com/ReactiveX/RxJava/pull/3931","diff_url":"https://github.com/ReactiveX/RxJava/pull/3931.diff","patch_url":"https://github.com/ReactiveX/RxJava/pull/3931.patch"},"body":"I have a long running stream using `groupBy` that over time will accumulate 10s of millions of keys. If I can specify an evicting map to `groupBy` then I'll be able to keep it down to ~10,000 keys. \r\n\r\nThis PR supports this use case and could be used with Guava's `CacheBuilder` like this:\r\n\r\n```java\r\nFunc1<Action1<K>, Map<K, Object>> mapFactory = \r\n    action -> CacheBuilder.newBuilder()\r\n              .maximumSize(1000)\r\n              .expireAfterAccess(12, TimeUnit.HOUR)\r\n              .removalListener(key -> action.call(key))\r\n              .<K, Object> build().asMap();\r\nobservable\r\n    .groupBy(keySelector, elementSelector, mapFactory)\r\n    ...\r\n```\r\nI'll enhance this PR with more unit tests if this looks a good direction.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ReactiveX/RxJava/issues/comments/228527184","html_url":"https://github.com/ReactiveX/RxJava/pull/3931#issuecomment-228527184","issue_url":"https://api.github.com/repos/ReactiveX/RxJava/issues/3931","id":228527184,"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},"created_at":"2016-06-25T09:47:43Z","updated_at":"2016-06-25T09:47:43Z","body":"Thanks @davidmoten for the contribution!"}}
{"actor":{"display_login":"akarnokd"}}