{"action":"closed","number":315,"pull_request":{"url":"https://api.github.com/repos/javaslang/javaslang/pulls/315","id":38807926,"html_url":"https://github.com/javaslang/javaslang/pull/315","diff_url":"https://github.com/javaslang/javaslang/pull/315.diff","patch_url":"https://github.com/javaslang/javaslang/pull/315.patch","issue_url":"https://api.github.com/repos/javaslang/javaslang/issues/315","number":315,"state":"closed","locked":false,"title":"Adding matching on a range of values.","user":{"login":"martincooper","id":693084,"avatar_url":"https://avatars.githubusercontent.com/u/693084?v=3","gravatar_id":"","url":"https://api.github.com/users/martincooper","html_url":"https://github.com/martincooper","followers_url":"https://api.github.com/users/martincooper/followers","following_url":"https://api.github.com/users/martincooper/following{/other_user}","gists_url":"https://api.github.com/users/martincooper/gists{/gist_id}","starred_url":"https://api.github.com/users/martincooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martincooper/subscriptions","organizations_url":"https://api.github.com/users/martincooper/orgs","repos_url":"https://api.github.com/users/martincooper/repos","events_url":"https://api.github.com/users/martincooper/events{/privacy}","received_events_url":"https://api.github.com/users/martincooper/received_events","type":"User","site_admin":false},"body":"Hi Daniel,\r\n\r\nI've implemented the matching which I raised an issue for the other day. I think this looks like a reasonable way to do it. \r\n\r\n```java\r\n        final String result = Match\r\n                .whenIn(new Integer[] { 1, 3, 5, 7 }, x -> \"true\")\r\n                .whenIn(new Integer[] { 2, 4, 6, 8 }, x -> \"false\")\r\n                .when(10, x -> \"other\")\r\n                .apply(6);\r\n\r\n        assertThat(result).isEqualTo(\"false\");\r\n```\r\nThe array creation inside the \"whenIn\" is a bit more verbose than I would have liked. It's a pity I can't use ```T... prototypes``` as the argument for the method as it's not the last argument.\r\n\r\nMaybe something along the lines of this would be nice...\r\n\r\n        final String result = Match\r\n                .whenIn(1, 3, 5, 7).then(x -> \"true\")\r\n                .whenIn(2, 4, 6, 8).then(x -> \"false\")\r\n                .when(10).then(x -> \"other\")\r\n                .apply(6);\r\n\r\nAlthough this would most likely require a significant re-work.\r\n\r\nThanks\r\n\r\nMartin","created_at":"2015-06-29T19:23:22Z","updated_at":"2015-07-01T22:51:23Z","closed_at":"2015-07-01T22:51:23Z","merged_at":null,"merge_commit_sha":"5a3120820bc225414db2988739ed645dc4ff31e7","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/javaslang/javaslang/pulls/315/commits","review_comments_url":"https://api.github.com/repos/javaslang/javaslang/pulls/315/comments","review_comment_url":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}","comments_url":"https://api.github.com/repos/javaslang/javaslang/issues/315/comments","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/745eaa663e37ed6ffe25aecac86a3ade4f0521c2","head":{"label":"martincooper:master","ref":"master","sha":"745eaa663e37ed6ffe25aecac86a3ade4f0521c2","user":{"login":"martincooper","id":693084,"avatar_url":"https://avatars.githubusercontent.com/u/693084?v=3","gravatar_id":"","url":"https://api.github.com/users/martincooper","html_url":"https://github.com/martincooper","followers_url":"https://api.github.com/users/martincooper/followers","following_url":"https://api.github.com/users/martincooper/following{/other_user}","gists_url":"https://api.github.com/users/martincooper/gists{/gist_id}","starred_url":"https://api.github.com/users/martincooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martincooper/subscriptions","organizations_url":"https://api.github.com/users/martincooper/orgs","repos_url":"https://api.github.com/users/martincooper/repos","events_url":"https://api.github.com/users/martincooper/events{/privacy}","received_events_url":"https://api.github.com/users/martincooper/received_events","type":"User","site_admin":false},"repo":null},"base":{"label":"javaslang:master","ref":"master","sha":"b88f1e4824a1d121b5678acf4d957a9bd1f62933","user":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"User","site_admin":false},"repo":{"id":16378879,"name":"javaslang","full_name":"javaslang/javaslang","owner":{"login":"javaslang","id":5786132,"avatar_url":"https://avatars.githubusercontent.com/u/5786132?v=3","gravatar_id":"","url":"https://api.github.com/users/javaslang","html_url":"https://github.com/javaslang","followers_url":"https://api.github.com/users/javaslang/followers","following_url":"https://api.github.com/users/javaslang/following{/other_user}","gists_url":"https://api.github.com/users/javaslang/gists{/gist_id}","starred_url":"https://api.github.com/users/javaslang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/javaslang/subscriptions","organizations_url":"https://api.github.com/users/javaslang/orgs","repos_url":"https://api.github.com/users/javaslang/repos","events_url":"https://api.github.com/users/javaslang/events{/privacy}","received_events_url":"https://api.github.com/users/javaslang/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/javaslang/javaslang","description":"A functional component library built for Java 8+ that provides persistent data types and functional control structures.","fork":false,"url":"https://api.github.com/repos/javaslang/javaslang","forks_url":"https://api.github.com/repos/javaslang/javaslang/forks","keys_url":"https://api.github.com/repos/javaslang/javaslang/keys{/key_id}","collaborators_url":"https://api.github.com/repos/javaslang/javaslang/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/javaslang/javaslang/teams","hooks_url":"https://api.github.com/repos/javaslang/javaslang/hooks","issue_events_url":"https://api.github.com/repos/javaslang/javaslang/issues/events{/number}","events_url":"https://api.github.com/repos/javaslang/javaslang/events","assignees_url":"https://api.github.com/repos/javaslang/javaslang/assignees{/user}","branches_url":"https://api.github.com/repos/javaslang/javaslang/branches{/branch}","tags_url":"https://api.github.com/repos/javaslang/javaslang/tags","blobs_url":"https://api.github.com/repos/javaslang/javaslang/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/javaslang/javaslang/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/javaslang/javaslang/git/refs{/sha}","trees_url":"https://api.github.com/repos/javaslang/javaslang/git/trees{/sha}","statuses_url":"https://api.github.com/repos/javaslang/javaslang/statuses/{sha}","languages_url":"https://api.github.com/repos/javaslang/javaslang/languages","stargazers_url":"https://api.github.com/repos/javaslang/javaslang/stargazers","contributors_url":"https://api.github.com/repos/javaslang/javaslang/contributors","subscribers_url":"https://api.github.com/repos/javaslang/javaslang/subscribers","subscription_url":"https://api.github.com/repos/javaslang/javaslang/subscription","commits_url":"https://api.github.com/repos/javaslang/javaslang/commits{/sha}","git_commits_url":"https://api.github.com/repos/javaslang/javaslang/git/commits{/sha}","comments_url":"https://api.github.com/repos/javaslang/javaslang/comments{/number}","issue_comment_url":"https://api.github.com/repos/javaslang/javaslang/issues/comments{/number}","contents_url":"https://api.github.com/repos/javaslang/javaslang/contents/{+path}","compare_url":"https://api.github.com/repos/javaslang/javaslang/compare/{base}...{head}","merges_url":"https://api.github.com/repos/javaslang/javaslang/merges","archive_url":"https://api.github.com/repos/javaslang/javaslang/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/javaslang/javaslang/downloads","issues_url":"https://api.github.com/repos/javaslang/javaslang/issues{/number}","pulls_url":"https://api.github.com/repos/javaslang/javaslang/pulls{/number}","milestones_url":"https://api.github.com/repos/javaslang/javaslang/milestones{/number}","notifications_url":"https://api.github.com/repos/javaslang/javaslang/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/javaslang/javaslang/labels{/name}","releases_url":"https://api.github.com/repos/javaslang/javaslang/releases{/id}","created_at":"2014-01-30T14:07:25Z","updated_at":"2015-07-01T20:41:47Z","pushed_at":"2015-07-01T22:51:23Z","git_url":"git://github.com/javaslang/javaslang.git","ssh_url":"git@github.com:javaslang/javaslang.git","clone_url":"https://github.com/javaslang/javaslang.git","svn_url":"https://github.com/javaslang/javaslang","homepage":"http://javaslang.com","size":6837,"stargazers_count":238,"watchers_count":238,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":27,"mirror_url":null,"open_issues_count":62,"forks":27,"open_issues":62,"watchers":238,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/315"},"html":{"href":"https://github.com/javaslang/javaslang/pull/315"},"issue":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/315"},"comments":{"href":"https://api.github.com/repos/javaslang/javaslang/issues/315/comments"},"review_comments":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/315/comments"},"review_comment":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/javaslang/javaslang/pulls/315/commits"},"statuses":{"href":"https://api.github.com/repos/javaslang/javaslang/statuses/745eaa663e37ed6ffe25aecac86a3ade4f0521c2"}},"merged":false,"mergeable":true,"mergeable_state":"unstable","merged_by":null,"comments":4,"review_comments":0,"commits":2,"additions":64,"deletions":0,"changed_files":2}}