{"action":"created","comment":{"url":"https://api.github.com/repos/exercism/xjava/pulls/comments/27770244","id":27770244,"diff_hunk":"@@ -0,0 +1,48 @@\n+import java.util.ArrayList;\n+import java.util.List;\n+\n+public class Atbash {\n+\n+    private static final int GROUP_SIZE = 5;\n+    private static final String PLAIN = \"abcdefghijklmnopqrstuvwxyz\";\n+    private static final String CIPHER = \"zyxwvutsrqponmlkjihgfedcba\";\n+\n+    public static String encode(String input) {\n+        String encoded = stripInvalidCharacters(input).toLowerCase();\n+        String cyphered = \"\";\n+\n+        for (char c : encoded.toCharArray()) {\n+            cyphered += applyCipher(c);\n+        }\n+\n+        return splitIntoFiveLetterWords(cyphered);\n+    }\n+\n+    private static String stripInvalidCharacters(String input) {\n+        String filteredValue = \"\";\n+\n+        for (char c : input.toCharArray()) {\n+            if (Character.isLetterOrDigit(c)) {\n+                filteredValue += c;\n+            }\n+        }\n+\n+        return filteredValue;\n+    }\n+\n+    private static char applyCipher(char input) {\n+        int idx = PLAIN.indexOf(input);\n+\n+        return idx >= 0 ? CIPHER.toCharArray()[idx] : input;","path":"atbash-cipher/example.java","position":36,"original_position":36,"commit_id":"b304fee12852dd3fa300e7ded8472774769dfd86","original_commit_id":"b304fee12852dd3fa300e7ded8472774769dfd86","user":{"login":"sit","id":18608,"avatar_url":"https://avatars.githubusercontent.com/u/18608?v=3","gravatar_id":"","url":"https://api.github.com/users/sit","html_url":"https://github.com/sit","followers_url":"https://api.github.com/users/sit/followers","following_url":"https://api.github.com/users/sit/following{/other_user}","gists_url":"https://api.github.com/users/sit/gists{/gist_id}","starred_url":"https://api.github.com/users/sit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sit/subscriptions","organizations_url":"https://api.github.com/users/sit/orgs","repos_url":"https://api.github.com/users/sit/repos","events_url":"https://api.github.com/users/sit/events{/privacy}","received_events_url":"https://api.github.com/users/sit/received_events","type":"User","site_admin":false},"body":"Could extract a constant of `CIPHER.toCharArray()` --- not sure if the compiler would optimize this to avoid having to run this conversion every time.","created_at":"2015-04-04T16:46:30Z","updated_at":"2015-04-04T16:46:30Z","html_url":"https://github.com/exercism/xjava/pull/36#discussion_r27770244","pull_request_url":"https://api.github.com/repos/exercism/xjava/pulls/36","_links":{"self":{"href":"https://api.github.com/repos/exercism/xjava/pulls/comments/27770244"},"html":{"href":"https://github.com/exercism/xjava/pull/36#discussion_r27770244"},"pull_request":{"href":"https://api.github.com/repos/exercism/xjava/pulls/36"}}},"pull_request":{"url":"https://api.github.com/repos/exercism/xjava/pulls/36","id":32633313,"html_url":"https://github.com/exercism/xjava/pull/36","diff_url":"https://github.com/exercism/xjava/pull/36.diff","patch_url":"https://github.com/exercism/xjava/pull/36.patch","issue_url":"https://api.github.com/repos/exercism/xjava/issues/36","number":36,"state":"closed","locked":false,"title":"Added exercise atbash-cipher","user":{"login":"pietvandongen","id":472315,"avatar_url":"https://avatars.githubusercontent.com/u/472315?v=3","gravatar_id":"","url":"https://api.github.com/users/pietvandongen","html_url":"https://github.com/pietvandongen","followers_url":"https://api.github.com/users/pietvandongen/followers","following_url":"https://api.github.com/users/pietvandongen/following{/other_user}","gists_url":"https://api.github.com/users/pietvandongen/gists{/gist_id}","starred_url":"https://api.github.com/users/pietvandongen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pietvandongen/subscriptions","organizations_url":"https://api.github.com/users/pietvandongen/orgs","repos_url":"https://api.github.com/users/pietvandongen/repos","events_url":"https://api.github.com/users/pietvandongen/events{/privacy}","received_events_url":"https://api.github.com/users/pietvandongen/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-04-04T13:08:00Z","updated_at":"2015-04-04T16:46:30Z","closed_at":"2015-04-04T13:09:21Z","merged_at":"2015-04-04T13:09:21Z","merge_commit_sha":"736a31c04be4884acaebef3fb532aa1c4bd145dc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/exercism/xjava/pulls/36/commits","review_comments_url":"https://api.github.com/repos/exercism/xjava/pulls/36/comments","review_comment_url":"https://api.github.com/repos/exercism/xjava/pulls/comments{/number}","comments_url":"https://api.github.com/repos/exercism/xjava/issues/36/comments","statuses_url":"https://api.github.com/repos/exercism/xjava/statuses/b304fee12852dd3fa300e7ded8472774769dfd86","head":{"label":"exercism:atbash-cipher","ref":"atbash-cipher","sha":"b304fee12852dd3fa300e7ded8472774769dfd86","user":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"repo":{"id":17270540,"name":"xjava","full_name":"exercism/xjava","owner":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exercism/xjava","description":"Exercism Exercises in Java","fork":false,"url":"https://api.github.com/repos/exercism/xjava","forks_url":"https://api.github.com/repos/exercism/xjava/forks","keys_url":"https://api.github.com/repos/exercism/xjava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exercism/xjava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exercism/xjava/teams","hooks_url":"https://api.github.com/repos/exercism/xjava/hooks","issue_events_url":"https://api.github.com/repos/exercism/xjava/issues/events{/number}","events_url":"https://api.github.com/repos/exercism/xjava/events","assignees_url":"https://api.github.com/repos/exercism/xjava/assignees{/user}","branches_url":"https://api.github.com/repos/exercism/xjava/branches{/branch}","tags_url":"https://api.github.com/repos/exercism/xjava/tags","blobs_url":"https://api.github.com/repos/exercism/xjava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exercism/xjava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exercism/xjava/git/refs{/sha}","trees_url":"https://api.github.com/repos/exercism/xjava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exercism/xjava/statuses/{sha}","languages_url":"https://api.github.com/repos/exercism/xjava/languages","stargazers_url":"https://api.github.com/repos/exercism/xjava/stargazers","contributors_url":"https://api.github.com/repos/exercism/xjava/contributors","subscribers_url":"https://api.github.com/repos/exercism/xjava/subscribers","subscription_url":"https://api.github.com/repos/exercism/xjava/subscription","commits_url":"https://api.github.com/repos/exercism/xjava/commits{/sha}","git_commits_url":"https://api.github.com/repos/exercism/xjava/git/commits{/sha}","comments_url":"https://api.github.com/repos/exercism/xjava/comments{/number}","issue_comment_url":"https://api.github.com/repos/exercism/xjava/issues/comments{/number}","contents_url":"https://api.github.com/repos/exercism/xjava/contents/{+path}","compare_url":"https://api.github.com/repos/exercism/xjava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exercism/xjava/merges","archive_url":"https://api.github.com/repos/exercism/xjava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exercism/xjava/downloads","issues_url":"https://api.github.com/repos/exercism/xjava/issues{/number}","pulls_url":"https://api.github.com/repos/exercism/xjava/pulls{/number}","milestones_url":"https://api.github.com/repos/exercism/xjava/milestones{/number}","notifications_url":"https://api.github.com/repos/exercism/xjava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exercism/xjava/labels{/name}","releases_url":"https://api.github.com/repos/exercism/xjava/releases{/id}","created_at":"2014-02-28T00:45:13Z","updated_at":"2015-04-04T13:48:23Z","pushed_at":"2015-04-04T13:48:23Z","git_url":"git://github.com/exercism/xjava.git","ssh_url":"git@github.com:exercism/xjava.git","clone_url":"https://github.com/exercism/xjava.git","svn_url":"https://github.com/exercism/xjava","homepage":null,"size":23981,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":6,"forks":15,"open_issues":6,"watchers":17,"default_branch":"master"}},"base":{"label":"exercism:master","ref":"master","sha":"58f57b387e66b1e6f821c20ee733e9b221867f3b","user":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"repo":{"id":17270540,"name":"xjava","full_name":"exercism/xjava","owner":{"login":"exercism","id":5624255,"avatar_url":"https://avatars.githubusercontent.com/u/5624255?v=3","gravatar_id":"","url":"https://api.github.com/users/exercism","html_url":"https://github.com/exercism","followers_url":"https://api.github.com/users/exercism/followers","following_url":"https://api.github.com/users/exercism/following{/other_user}","gists_url":"https://api.github.com/users/exercism/gists{/gist_id}","starred_url":"https://api.github.com/users/exercism/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/exercism/subscriptions","organizations_url":"https://api.github.com/users/exercism/orgs","repos_url":"https://api.github.com/users/exercism/repos","events_url":"https://api.github.com/users/exercism/events{/privacy}","received_events_url":"https://api.github.com/users/exercism/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/exercism/xjava","description":"Exercism Exercises in Java","fork":false,"url":"https://api.github.com/repos/exercism/xjava","forks_url":"https://api.github.com/repos/exercism/xjava/forks","keys_url":"https://api.github.com/repos/exercism/xjava/keys{/key_id}","collaborators_url":"https://api.github.com/repos/exercism/xjava/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/exercism/xjava/teams","hooks_url":"https://api.github.com/repos/exercism/xjava/hooks","issue_events_url":"https://api.github.com/repos/exercism/xjava/issues/events{/number}","events_url":"https://api.github.com/repos/exercism/xjava/events","assignees_url":"https://api.github.com/repos/exercism/xjava/assignees{/user}","branches_url":"https://api.github.com/repos/exercism/xjava/branches{/branch}","tags_url":"https://api.github.com/repos/exercism/xjava/tags","blobs_url":"https://api.github.com/repos/exercism/xjava/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/exercism/xjava/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/exercism/xjava/git/refs{/sha}","trees_url":"https://api.github.com/repos/exercism/xjava/git/trees{/sha}","statuses_url":"https://api.github.com/repos/exercism/xjava/statuses/{sha}","languages_url":"https://api.github.com/repos/exercism/xjava/languages","stargazers_url":"https://api.github.com/repos/exercism/xjava/stargazers","contributors_url":"https://api.github.com/repos/exercism/xjava/contributors","subscribers_url":"https://api.github.com/repos/exercism/xjava/subscribers","subscription_url":"https://api.github.com/repos/exercism/xjava/subscription","commits_url":"https://api.github.com/repos/exercism/xjava/commits{/sha}","git_commits_url":"https://api.github.com/repos/exercism/xjava/git/commits{/sha}","comments_url":"https://api.github.com/repos/exercism/xjava/comments{/number}","issue_comment_url":"https://api.github.com/repos/exercism/xjava/issues/comments{/number}","contents_url":"https://api.github.com/repos/exercism/xjava/contents/{+path}","compare_url":"https://api.github.com/repos/exercism/xjava/compare/{base}...{head}","merges_url":"https://api.github.com/repos/exercism/xjava/merges","archive_url":"https://api.github.com/repos/exercism/xjava/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/exercism/xjava/downloads","issues_url":"https://api.github.com/repos/exercism/xjava/issues{/number}","pulls_url":"https://api.github.com/repos/exercism/xjava/pulls{/number}","milestones_url":"https://api.github.com/repos/exercism/xjava/milestones{/number}","notifications_url":"https://api.github.com/repos/exercism/xjava/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/exercism/xjava/labels{/name}","releases_url":"https://api.github.com/repos/exercism/xjava/releases{/id}","created_at":"2014-02-28T00:45:13Z","updated_at":"2015-04-04T13:48:23Z","pushed_at":"2015-04-04T13:48:23Z","git_url":"git://github.com/exercism/xjava.git","ssh_url":"git@github.com:exercism/xjava.git","clone_url":"https://github.com/exercism/xjava.git","svn_url":"https://github.com/exercism/xjava","homepage":null,"size":23981,"stargazers_count":17,"watchers_count":17,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":6,"forks":15,"open_issues":6,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/exercism/xjava/pulls/36"},"html":{"href":"https://github.com/exercism/xjava/pull/36"},"issue":{"href":"https://api.github.com/repos/exercism/xjava/issues/36"},"comments":{"href":"https://api.github.com/repos/exercism/xjava/issues/36/comments"},"review_comments":{"href":"https://api.github.com/repos/exercism/xjava/pulls/36/comments"},"review_comment":{"href":"https://api.github.com/repos/exercism/xjava/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/exercism/xjava/pulls/36/commits"},"statuses":{"href":"https://api.github.com/repos/exercism/xjava/statuses/b304fee12852dd3fa300e7ded8472774769dfd86"}}}}