{"action":"created","comment":{"url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/comments/44140049","id":44140049,"diff_hunk":"@@ -49,49 +50,39 @@ public Radio(WebElement wrappedElement) {\n      * @return {@code WebElement} representing selected radio button or {@code null} if no radio buttons are selected.\n      */\n     public WebElement getSelectedButton() {\n-        for (WebElement button : getButtons()) {\n-            if (button.isSelected()) {\n-                return button;\n-            }\n-        }\n-\n-        throw new NoSuchElementException(\"No selected button\");\n+        return getButtons().stream()\n+                .filter(WebElement::isSelected)\n+                .findAny()\n+                .orElseThrow(() -> new NoSuchElementException(\"No selected button\"));\n     }\n \n     /**\n-     * Indicates if radio has selected button.\n+     * Indicates if radio group has selected button.\n      *\n      * @return {@code true} if radio has selected button and {@code false} otherwise.\n      */\n     public boolean hasSelectedButton() {\n-        for (WebElement button : getButtons()) {\n-            if (button.isSelected()) {\n-                return true;\n-            }\n-        }\n-\n-        return false;\n+        return getButtons().stream()\n+                .anyMatch(WebElement::isSelected);\n     }\n \n     /**\n-     * Selects radio button that have a value matching the specified argument.\n+     * Selects first radio button that has a value matching the specified argument.\n      *\n      * @param value The value to match against.\n      */\n     public void selectByValue(String value) {\n-        for (WebElement button : getButtons()) {\n-            String buttonValue = button.getAttribute(\"value\");\n-            if (value.equals(buttonValue)) {\n-                selectButton(button);\n-                return;\n-            }\n-        }\n+        Optional<WebElement> matchingButton = getButtons().stream()\n+                .filter(b -> value.equals(b.getAttribute(\"value\")))\n+                .findFirst();\n \n-        throw new NoSuchElementException(String.format(\"Cannot locate radio button with value: %s\", value));\n+        selectButton(matchingButton\n+                .orElseThrow(() -> new NoSuchElementException(\n+                        \"Cannot locate radio button with value: \" + value)));","path":"htmlelements-java/src/main/java/ru/yandex/qatools/htmlelements/element/Radio.java","position":64,"original_position":64,"commit_id":"1a84314637b9ebeaaf4bdc78b909c1741e47c26f","original_commit_id":"1a84314637b9ebeaaf4bdc78b909c1741e47c26f","user":{"login":"ham1","id":3393038,"avatar_url":"https://avatars.githubusercontent.com/u/3393038?v=3","gravatar_id":"","url":"https://api.github.com/users/ham1","html_url":"https://github.com/ham1","followers_url":"https://api.github.com/users/ham1/followers","following_url":"https://api.github.com/users/ham1/following{/other_user}","gists_url":"https://api.github.com/users/ham1/gists{/gist_id}","starred_url":"https://api.github.com/users/ham1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ham1/subscriptions","organizations_url":"https://api.github.com/users/ham1/orgs","repos_url":"https://api.github.com/users/ham1/repos","events_url":"https://api.github.com/users/ham1/events{/privacy}","received_events_url":"https://api.github.com/users/ham1/received_events","type":"User","site_admin":false},"body":"The main reason I removed it was to improve readability as I think it's easier to read, especially since it only has one parameter which is at the end. Readability trumps any performance gain, especially when compared to the slowness of Selenium/browser interactions.\r\n\r\nI can indeed keep the old String.format if it's for consistency or other reasons I've missed?","created_at":"2015-11-06T14:17:42Z","updated_at":"2015-11-06T14:17:42Z","html_url":"https://github.com/yandex-qatools/htmlelements/pull/98#discussion_r44140049","pull_request_url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98","_links":{"self":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/comments/44140049"},"html":{"href":"https://github.com/yandex-qatools/htmlelements/pull/98#discussion_r44140049"},"pull_request":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98"}}},"pull_request":{"url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98","id":48678205,"html_url":"https://github.com/yandex-qatools/htmlelements/pull/98","diff_url":"https://github.com/yandex-qatools/htmlelements/pull/98.diff","patch_url":"https://github.com/yandex-qatools/htmlelements/pull/98.patch","issue_url":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/98","number":98,"state":"open","locked":false,"title":"Update to Java 8","user":{"login":"ham1","id":3393038,"avatar_url":"https://avatars.githubusercontent.com/u/3393038?v=3","gravatar_id":"","url":"https://api.github.com/users/ham1","html_url":"https://github.com/ham1","followers_url":"https://api.github.com/users/ham1/followers","following_url":"https://api.github.com/users/ham1/following{/other_user}","gists_url":"https://api.github.com/users/ham1/gists{/gist_id}","starred_url":"https://api.github.com/users/ham1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ham1/subscriptions","organizations_url":"https://api.github.com/users/ham1/orgs","repos_url":"https://api.github.com/users/ham1/repos","events_url":"https://api.github.com/users/ham1/events{/privacy}","received_events_url":"https://api.github.com/users/ham1/received_events","type":"User","site_admin":false},"body":"Fixed previous botched PR. This relates to issue #96.","created_at":"2015-10-25T13:13:16Z","updated_at":"2015-11-06T14:17:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3a0077e86a068e4dfd70142c89c4c6a721ea5bc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98/commits","review_comments_url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98/comments","review_comment_url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/98/comments","statuses_url":"https://api.github.com/repos/yandex-qatools/htmlelements/statuses/1a84314637b9ebeaaf4bdc78b909c1741e47c26f","head":{"label":"ham1:java8","ref":"java8","sha":"1a84314637b9ebeaaf4bdc78b909c1741e47c26f","user":{"login":"ham1","id":3393038,"avatar_url":"https://avatars.githubusercontent.com/u/3393038?v=3","gravatar_id":"","url":"https://api.github.com/users/ham1","html_url":"https://github.com/ham1","followers_url":"https://api.github.com/users/ham1/followers","following_url":"https://api.github.com/users/ham1/following{/other_user}","gists_url":"https://api.github.com/users/ham1/gists{/gist_id}","starred_url":"https://api.github.com/users/ham1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ham1/subscriptions","organizations_url":"https://api.github.com/users/ham1/orgs","repos_url":"https://api.github.com/users/ham1/repos","events_url":"https://api.github.com/users/ham1/events{/privacy}","received_events_url":"https://api.github.com/users/ham1/received_events","type":"User","site_admin":false},"repo":{"id":44575436,"name":"htmlelements","full_name":"ham1/htmlelements","owner":{"login":"ham1","id":3393038,"avatar_url":"https://avatars.githubusercontent.com/u/3393038?v=3","gravatar_id":"","url":"https://api.github.com/users/ham1","html_url":"https://github.com/ham1","followers_url":"https://api.github.com/users/ham1/followers","following_url":"https://api.github.com/users/ham1/following{/other_user}","gists_url":"https://api.github.com/users/ham1/gists{/gist_id}","starred_url":"https://api.github.com/users/ham1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ham1/subscriptions","organizations_url":"https://api.github.com/users/ham1/orgs","repos_url":"https://api.github.com/users/ham1/repos","events_url":"https://api.github.com/users/ham1/events{/privacy}","received_events_url":"https://api.github.com/users/ham1/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ham1/htmlelements","description":"Html Elements is a Java framework providing easy-to-use way of interaction with web-page elements in web-page tests.","fork":true,"url":"https://api.github.com/repos/ham1/htmlelements","forks_url":"https://api.github.com/repos/ham1/htmlelements/forks","keys_url":"https://api.github.com/repos/ham1/htmlelements/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ham1/htmlelements/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ham1/htmlelements/teams","hooks_url":"https://api.github.com/repos/ham1/htmlelements/hooks","issue_events_url":"https://api.github.com/repos/ham1/htmlelements/issues/events{/number}","events_url":"https://api.github.com/repos/ham1/htmlelements/events","assignees_url":"https://api.github.com/repos/ham1/htmlelements/assignees{/user}","branches_url":"https://api.github.com/repos/ham1/htmlelements/branches{/branch}","tags_url":"https://api.github.com/repos/ham1/htmlelements/tags","blobs_url":"https://api.github.com/repos/ham1/htmlelements/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ham1/htmlelements/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ham1/htmlelements/git/refs{/sha}","trees_url":"https://api.github.com/repos/ham1/htmlelements/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ham1/htmlelements/statuses/{sha}","languages_url":"https://api.github.com/repos/ham1/htmlelements/languages","stargazers_url":"https://api.github.com/repos/ham1/htmlelements/stargazers","contributors_url":"https://api.github.com/repos/ham1/htmlelements/contributors","subscribers_url":"https://api.github.com/repos/ham1/htmlelements/subscribers","subscription_url":"https://api.github.com/repos/ham1/htmlelements/subscription","commits_url":"https://api.github.com/repos/ham1/htmlelements/commits{/sha}","git_commits_url":"https://api.github.com/repos/ham1/htmlelements/git/commits{/sha}","comments_url":"https://api.github.com/repos/ham1/htmlelements/comments{/number}","issue_comment_url":"https://api.github.com/repos/ham1/htmlelements/issues/comments{/number}","contents_url":"https://api.github.com/repos/ham1/htmlelements/contents/{+path}","compare_url":"https://api.github.com/repos/ham1/htmlelements/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ham1/htmlelements/merges","archive_url":"https://api.github.com/repos/ham1/htmlelements/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ham1/htmlelements/downloads","issues_url":"https://api.github.com/repos/ham1/htmlelements/issues{/number}","pulls_url":"https://api.github.com/repos/ham1/htmlelements/pulls{/number}","milestones_url":"https://api.github.com/repos/ham1/htmlelements/milestones{/number}","notifications_url":"https://api.github.com/repos/ham1/htmlelements/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ham1/htmlelements/labels{/name}","releases_url":"https://api.github.com/repos/ham1/htmlelements/releases{/id}","created_at":"2015-10-20T01:51:08Z","updated_at":"2015-10-20T01:51:10Z","pushed_at":"2015-10-31T13:43:57Z","git_url":"git://github.com/ham1/htmlelements.git","ssh_url":"git@github.com:ham1/htmlelements.git","clone_url":"https://github.com/ham1/htmlelements.git","svn_url":"https://github.com/ham1/htmlelements","homepage":"http://htmlelements.qatools.ru","size":874,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yandex-qatools:master","ref":"master","sha":"fc3fad75bf5e013de96ee84c00622c396677a321","user":{"login":"yandex-qatools","id":2365075,"avatar_url":"https://avatars.githubusercontent.com/u/2365075?v=3","gravatar_id":"","url":"https://api.github.com/users/yandex-qatools","html_url":"https://github.com/yandex-qatools","followers_url":"https://api.github.com/users/yandex-qatools/followers","following_url":"https://api.github.com/users/yandex-qatools/following{/other_user}","gists_url":"https://api.github.com/users/yandex-qatools/gists{/gist_id}","starred_url":"https://api.github.com/users/yandex-qatools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yandex-qatools/subscriptions","organizations_url":"https://api.github.com/users/yandex-qatools/orgs","repos_url":"https://api.github.com/users/yandex-qatools/repos","events_url":"https://api.github.com/users/yandex-qatools/events{/privacy}","received_events_url":"https://api.github.com/users/yandex-qatools/received_events","type":"Organization","site_admin":false},"repo":{"id":5963893,"name":"htmlelements","full_name":"yandex-qatools/htmlelements","owner":{"login":"yandex-qatools","id":2365075,"avatar_url":"https://avatars.githubusercontent.com/u/2365075?v=3","gravatar_id":"","url":"https://api.github.com/users/yandex-qatools","html_url":"https://github.com/yandex-qatools","followers_url":"https://api.github.com/users/yandex-qatools/followers","following_url":"https://api.github.com/users/yandex-qatools/following{/other_user}","gists_url":"https://api.github.com/users/yandex-qatools/gists{/gist_id}","starred_url":"https://api.github.com/users/yandex-qatools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yandex-qatools/subscriptions","organizations_url":"https://api.github.com/users/yandex-qatools/orgs","repos_url":"https://api.github.com/users/yandex-qatools/repos","events_url":"https://api.github.com/users/yandex-qatools/events{/privacy}","received_events_url":"https://api.github.com/users/yandex-qatools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yandex-qatools/htmlelements","description":"Html Elements is a Java framework providing easy-to-use way of interaction with web-page elements in web-page tests.","fork":false,"url":"https://api.github.com/repos/yandex-qatools/htmlelements","forks_url":"https://api.github.com/repos/yandex-qatools/htmlelements/forks","keys_url":"https://api.github.com/repos/yandex-qatools/htmlelements/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yandex-qatools/htmlelements/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yandex-qatools/htmlelements/teams","hooks_url":"https://api.github.com/repos/yandex-qatools/htmlelements/hooks","issue_events_url":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/events{/number}","events_url":"https://api.github.com/repos/yandex-qatools/htmlelements/events","assignees_url":"https://api.github.com/repos/yandex-qatools/htmlelements/assignees{/user}","branches_url":"https://api.github.com/repos/yandex-qatools/htmlelements/branches{/branch}","tags_url":"https://api.github.com/repos/yandex-qatools/htmlelements/tags","blobs_url":"https://api.github.com/repos/yandex-qatools/htmlelements/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yandex-qatools/htmlelements/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yandex-qatools/htmlelements/git/refs{/sha}","trees_url":"https://api.github.com/repos/yandex-qatools/htmlelements/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yandex-qatools/htmlelements/statuses/{sha}","languages_url":"https://api.github.com/repos/yandex-qatools/htmlelements/languages","stargazers_url":"https://api.github.com/repos/yandex-qatools/htmlelements/stargazers","contributors_url":"https://api.github.com/repos/yandex-qatools/htmlelements/contributors","subscribers_url":"https://api.github.com/repos/yandex-qatools/htmlelements/subscribers","subscription_url":"https://api.github.com/repos/yandex-qatools/htmlelements/subscription","commits_url":"https://api.github.com/repos/yandex-qatools/htmlelements/commits{/sha}","git_commits_url":"https://api.github.com/repos/yandex-qatools/htmlelements/git/commits{/sha}","comments_url":"https://api.github.com/repos/yandex-qatools/htmlelements/comments{/number}","issue_comment_url":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/comments{/number}","contents_url":"https://api.github.com/repos/yandex-qatools/htmlelements/contents/{+path}","compare_url":"https://api.github.com/repos/yandex-qatools/htmlelements/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yandex-qatools/htmlelements/merges","archive_url":"https://api.github.com/repos/yandex-qatools/htmlelements/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yandex-qatools/htmlelements/downloads","issues_url":"https://api.github.com/repos/yandex-qatools/htmlelements/issues{/number}","pulls_url":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls{/number}","milestones_url":"https://api.github.com/repos/yandex-qatools/htmlelements/milestones{/number}","notifications_url":"https://api.github.com/repos/yandex-qatools/htmlelements/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yandex-qatools/htmlelements/labels{/name}","releases_url":"https://api.github.com/repos/yandex-qatools/htmlelements/releases{/id}","created_at":"2012-09-26T09:56:23Z","updated_at":"2015-10-28T08:15:37Z","pushed_at":"2015-10-31T13:43:57Z","git_url":"git://github.com/yandex-qatools/htmlelements.git","ssh_url":"git@github.com:yandex-qatools/htmlelements.git","clone_url":"https://github.com/yandex-qatools/htmlelements.git","svn_url":"https://github.com/yandex-qatools/htmlelements","homepage":"http://htmlelements.qatools.ru","size":2078,"stargazers_count":121,"watchers_count":121,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":62,"mirror_url":null,"open_issues_count":24,"forks":62,"open_issues":24,"watchers":121,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98"},"html":{"href":"https://github.com/yandex-qatools/htmlelements/pull/98"},"issue":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/98"},"comments":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/issues/98/comments"},"review_comments":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98/comments"},"review_comment":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/pulls/98/commits"},"statuses":{"href":"https://api.github.com/repos/yandex-qatools/htmlelements/statuses/1a84314637b9ebeaaf4bdc78b909c1741e47c26f"}}}}