{"action":"created","comment":{"url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/comments/59552820","id":59552820,"diff_hunk":"@@ -1,8 +1,48 @@\n package com.theironyard.clt;\n \n+import java.io.File;\n+import java.io.FileNotFoundException;\n+import java.io.FileWriter;\n+import java.io.IOException;\n+import java.util.ArrayList;\n+import java.util.HashMap;\n+import java.util.Scanner;\n+\n public class Main {\n \n-    public static void main(String[] args) {\n-\t// write your code here\n+    public static void main(String[] args)throws IOException, FileNotFoundException{\n+        // write your code here\n+        HashMap<String, ArrayList<Country>> map = new HashMap<>();\n+        System.out.println(\"Please enter a letter for the search.\");\n+\n+        File f = new File(\"countries.txt\");\n+        Scanner fileScanner = new Scanner(f);\n+\n+        String key = null;\n+        while (fileScanner.hasNext()) {\n+\n+            String line = fileScanner.nextLine();\n+            String[] columns = line.split(\"\\\\|\");\n+            Country section = new Country(columns[0], columns[1]);\n+            key = String.valueOf(section.name.toUpperCase().charAt(0));\n+            map.putIfAbsent(key, new ArrayList<>());\n+            map.get(key).add(section);\n+        }\n+        //write new file with key name\n+        //fill with array list\n+        //close file\n+\n+        Scanner consoleScanner = new Scanner(System.in);\n+        String letter = consoleScanner.nextLine().toUpperCase();\n+\n+        File g = new File(String.format(\"%s_.txt\", letter));\n+\n+        FileWriter fw = new FileWriter(g);\n+\n+        fw.write(map.get(letter).toString());","path":"src/com/theironyard/clt/Main.java","position":44,"original_position":44,"commit_id":"099820fed7187f4d4c8336e3f0c12455db920f0c","original_commit_id":"099820fed7187f4d4c8336e3f0c12455db920f0c","user":{"login":"raynjamin","id":426472,"avatar_url":"https://avatars.githubusercontent.com/u/426472?v=3","gravatar_id":"","url":"https://api.github.com/users/raynjamin","html_url":"https://github.com/raynjamin","followers_url":"https://api.github.com/users/raynjamin/followers","following_url":"https://api.github.com/users/raynjamin/following{/other_user}","gists_url":"https://api.github.com/users/raynjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/raynjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/raynjamin/subscriptions","organizations_url":"https://api.github.com/users/raynjamin/orgs","repos_url":"https://api.github.com/users/raynjamin/repos","events_url":"https://api.github.com/users/raynjamin/events{/privacy}","received_events_url":"https://api.github.com/users/raynjamin/received_events","type":"User","site_admin":false},"body":"You need to override toString in your Country class for this to be pretty, and add a new line.","created_at":"2016-04-13T14:02:07Z","updated_at":"2016-04-13T14:02:07Z","html_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3#discussion_r59552820","pull_request_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/comments/59552820"},"html":{"href":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3#discussion_r59552820"},"pull_request":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3","id":66193226,"html_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3","diff_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3.diff","patch_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3.patch","issue_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/3","number":3,"state":"open","locked":false,"title":"HW","user":{"login":"zombieApoc","id":17968338,"avatar_url":"https://avatars.githubusercontent.com/u/17968338?v=3","gravatar_id":"","url":"https://api.github.com/users/zombieApoc","html_url":"https://github.com/zombieApoc","followers_url":"https://api.github.com/users/zombieApoc/followers","following_url":"https://api.github.com/users/zombieApoc/following{/other_user}","gists_url":"https://api.github.com/users/zombieApoc/gists{/gist_id}","starred_url":"https://api.github.com/users/zombieApoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombieApoc/subscriptions","organizations_url":"https://api.github.com/users/zombieApoc/orgs","repos_url":"https://api.github.com/users/zombieApoc/repos","events_url":"https://api.github.com/users/zombieApoc/events{/privacy}","received_events_url":"https://api.github.com/users/zombieApoc/received_events","type":"User","site_admin":false},"body":"had trouble with fw","created_at":"2016-04-12T17:05:47Z","updated_at":"2016-04-13T14:02:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8002fe35f9c33120ac7392de7fa0020d4322f6fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3/commits","review_comments_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3/comments","review_comment_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/comments{/number}","comments_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/3/comments","statuses_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/statuses/099820fed7187f4d4c8336e3f0c12455db920f0c","head":{"label":"zombieApoc:master","ref":"master","sha":"099820fed7187f4d4c8336e3f0c12455db920f0c","user":{"login":"zombieApoc","id":17968338,"avatar_url":"https://avatars.githubusercontent.com/u/17968338?v=3","gravatar_id":"","url":"https://api.github.com/users/zombieApoc","html_url":"https://github.com/zombieApoc","followers_url":"https://api.github.com/users/zombieApoc/followers","following_url":"https://api.github.com/users/zombieApoc/following{/other_user}","gists_url":"https://api.github.com/users/zombieApoc/gists{/gist_id}","starred_url":"https://api.github.com/users/zombieApoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombieApoc/subscriptions","organizations_url":"https://api.github.com/users/zombieApoc/orgs","repos_url":"https://api.github.com/users/zombieApoc/repos","events_url":"https://api.github.com/users/zombieApoc/events{/privacy}","received_events_url":"https://api.github.com/users/zombieApoc/received_events","type":"User","site_admin":false},"repo":{"id":55720919,"name":"FileIO-Continued","full_name":"zombieApoc/FileIO-Continued","owner":{"login":"zombieApoc","id":17968338,"avatar_url":"https://avatars.githubusercontent.com/u/17968338?v=3","gravatar_id":"","url":"https://api.github.com/users/zombieApoc","html_url":"https://github.com/zombieApoc","followers_url":"https://api.github.com/users/zombieApoc/followers","following_url":"https://api.github.com/users/zombieApoc/following{/other_user}","gists_url":"https://api.github.com/users/zombieApoc/gists{/gist_id}","starred_url":"https://api.github.com/users/zombieApoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zombieApoc/subscriptions","organizations_url":"https://api.github.com/users/zombieApoc/orgs","repos_url":"https://api.github.com/users/zombieApoc/repos","events_url":"https://api.github.com/users/zombieApoc/events{/privacy}","received_events_url":"https://api.github.com/users/zombieApoc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zombieApoc/FileIO-Continued","description":"Let's talk FILES","fork":true,"url":"https://api.github.com/repos/zombieApoc/FileIO-Continued","forks_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/forks","keys_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/teams","hooks_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/hooks","issue_events_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/issues/events{/number}","events_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/events","assignees_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/assignees{/user}","branches_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/branches{/branch}","tags_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/tags","blobs_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/git/refs{/sha}","trees_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/statuses/{sha}","languages_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/languages","stargazers_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/stargazers","contributors_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/contributors","subscribers_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/subscribers","subscription_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/subscription","commits_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/commits{/sha}","git_commits_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/git/commits{/sha}","comments_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/comments{/number}","issue_comment_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/issues/comments{/number}","contents_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/contents/{+path}","compare_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/merges","archive_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/downloads","issues_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/issues{/number}","pulls_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/pulls{/number}","milestones_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/milestones{/number}","notifications_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/labels{/name}","releases_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/releases{/id}","deployments_url":"https://api.github.com/repos/zombieApoc/FileIO-Continued/deployments","created_at":"2016-04-07T19:10:08Z","updated_at":"2016-04-07T19:10:09Z","pushed_at":"2016-04-12T17:04:51Z","git_url":"git://github.com/zombieApoc/FileIO-Continued.git","ssh_url":"git@github.com:zombieApoc/FileIO-Continued.git","clone_url":"https://github.com/zombieApoc/FileIO-Continued.git","svn_url":"https://github.com/zombieApoc/FileIO-Continued","homepage":null,"size":18,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"TIY-Charlotte-Java:master","ref":"master","sha":"dca56bfd29f20c891f1c97df5a0dec1023e717d7","user":{"login":"TIY-Charlotte-Java","id":17955174,"avatar_url":"https://avatars.githubusercontent.com/u/17955174?v=3","gravatar_id":"","url":"https://api.github.com/users/TIY-Charlotte-Java","html_url":"https://github.com/TIY-Charlotte-Java","followers_url":"https://api.github.com/users/TIY-Charlotte-Java/followers","following_url":"https://api.github.com/users/TIY-Charlotte-Java/following{/other_user}","gists_url":"https://api.github.com/users/TIY-Charlotte-Java/gists{/gist_id}","starred_url":"https://api.github.com/users/TIY-Charlotte-Java/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TIY-Charlotte-Java/subscriptions","organizations_url":"https://api.github.com/users/TIY-Charlotte-Java/orgs","repos_url":"https://api.github.com/users/TIY-Charlotte-Java/repos","events_url":"https://api.github.com/users/TIY-Charlotte-Java/events{/privacy}","received_events_url":"https://api.github.com/users/TIY-Charlotte-Java/received_events","type":"Organization","site_admin":false},"repo":{"id":55716278,"name":"FileIO-Continued","full_name":"TIY-Charlotte-Java/FileIO-Continued","owner":{"login":"TIY-Charlotte-Java","id":17955174,"avatar_url":"https://avatars.githubusercontent.com/u/17955174?v=3","gravatar_id":"","url":"https://api.github.com/users/TIY-Charlotte-Java","html_url":"https://github.com/TIY-Charlotte-Java","followers_url":"https://api.github.com/users/TIY-Charlotte-Java/followers","following_url":"https://api.github.com/users/TIY-Charlotte-Java/following{/other_user}","gists_url":"https://api.github.com/users/TIY-Charlotte-Java/gists{/gist_id}","starred_url":"https://api.github.com/users/TIY-Charlotte-Java/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TIY-Charlotte-Java/subscriptions","organizations_url":"https://api.github.com/users/TIY-Charlotte-Java/orgs","repos_url":"https://api.github.com/users/TIY-Charlotte-Java/repos","events_url":"https://api.github.com/users/TIY-Charlotte-Java/events{/privacy}","received_events_url":"https://api.github.com/users/TIY-Charlotte-Java/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued","description":"Let's talk FILES","fork":false,"url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued","forks_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/forks","keys_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/keys{/key_id}","collaborators_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/teams","hooks_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/hooks","issue_events_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/events{/number}","events_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/events","assignees_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/assignees{/user}","branches_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/branches{/branch}","tags_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/tags","blobs_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/git/refs{/sha}","trees_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/git/trees{/sha}","statuses_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/statuses/{sha}","languages_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/languages","stargazers_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/stargazers","contributors_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/contributors","subscribers_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/subscribers","subscription_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/subscription","commits_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/commits{/sha}","git_commits_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/git/commits{/sha}","comments_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/comments{/number}","issue_comment_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/comments{/number}","contents_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/contents/{+path}","compare_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/compare/{base}...{head}","merges_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/merges","archive_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/downloads","issues_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues{/number}","pulls_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls{/number}","milestones_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/milestones{/number}","notifications_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/labels{/name}","releases_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/releases{/id}","deployments_url":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/deployments","created_at":"2016-04-07T17:59:43Z","updated_at":"2016-04-07T17:59:55Z","pushed_at":"2016-04-13T13:47:56Z","git_url":"git://github.com/TIY-Charlotte-Java/FileIO-Continued.git","ssh_url":"git@github.com:TIY-Charlotte-Java/FileIO-Continued.git","clone_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued.git","svn_url":"https://github.com/TIY-Charlotte-Java/FileIO-Continued","homepage":null,"size":5,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":1,"forks":2,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3"},"html":{"href":"https://github.com/TIY-Charlotte-Java/FileIO-Continued/pull/3"},"issue":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/3"},"comments":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/TIY-Charlotte-Java/FileIO-Continued/statuses/099820fed7187f4d4c8336e3f0c12455db920f0c"}}}}