{"action":"created","comment":{"url":"https://api.github.com/repos/beadss/java8-study/pulls/comments/178728478","pull_request_review_id":108827509,"id":178728478,"diff_hunk":"@@ -0,0 +1,98 @@\n+package joont92;\n+\n+import java.util.*;\n+\n+public class LottoMachine {\n+    private static final Scanner scanner = new Scanner(System.in);\n+    private static final int LOTTO_PRICE = 1000;\n+    private static final int LIMIT_PRICE = 100000;\n+\n+    private List<Integer> winningNumber = null;\n+\n+    public List<Lotto> purchase(int money){\n+        List<Lotto> lottoList = null;\n+\n+        if(money < LOTTO_PRICE){\n+            System.out.printf(\"최소 구입금액 : %d\\n\", LOTTO_PRICE);\n+        } else if(money > LIMIT_PRICE){\n+            System.out.printf(\"최대 구입금액 : %d\\n\", LIMIT_PRICE);\n+        } else{\n+            lottoList = new ArrayList<Lotto>();\n+\n+            int count = money / LOTTO_PRICE;\n+            System.out.printf(\"%d개를 구매했습니다\\n\", count);\n+\n+            for (int i = 0; i < count; i++) {\n+                Lotto lotto = new Lotto();\n+\n+                lottoList.add(lotto);\n+                lotto.print();\n+            }\n+        }\n+\n+        return lottoList;\n+    }\n+\n+    public void setWinningNumber(){\n+        System.out.println(\"당첨 번호를 입력해 주세요.\");\n+\n+        winningNumber = new ArrayList<Integer>();\n+        do{\n+            try{\n+                Integer num = scanner.nextInt();\n+\n+                if(num < Lotto.MIN_NUM || num > Lotto.MAX_NUM){\n+                    System.out.printf(\"범위를 벗어남 : %d (%d 부터 %d 까지의 값을 입력하셔야 합니다.)\\n\", num, Lotto.MIN_NUM, Lotto.MAX_NUM);\n+                } else{\n+                    if(!winningNumber.contains(num)){\n+                        winningNumber.add(num);\n+                    } else{\n+                        System.out.println(\"이미 등록된 번호입니다.\");\n+                    }\n+                }\n+            } catch(InputMismatchException e){\n+                scanner.nextLine();\n+                System.out.println(\"숫자만 입력 가능\");\n+            }\n+        } while(winningNumber.size() < 6);\n+    }\n+\n+    public void draw(List<Lotto> lottoList){\n+        if (winningNumber == null) {\n+            System.out.println(\"아직 추첨 전 입니다.\");\n+        } else{\n+            for (Lotto lotto : lottoList) {\n+                lotto.setRank(winningNumber);\n+            }\n+        }\n+\n+        Map<String, List<Lotto>> group = new HashMap<String, List<Lotto>>();\n+\n+        for (Lotto lotto : lottoList) {\n+            if (lotto.getRank() != null) {\n+                String key = lotto.getRank().name();\n+                if(!group.containsKey(key)){\n+                    group.put(key, new ArrayList<Lotto>());\n+                }\n+\n+                group.get(key).add(lotto);\n+            }\n+        }\n+\n+        System.out.println(\"당첨 통계\");\n+        System.out.println(\"--------------------\");\n+        long sum = 0;\n+        for (Lotto.Rank rank : Lotto.Rank.values()) {\n+            if(group.containsKey(rank.name())){\n+                List<Lotto> list = group.get(rank.name());\n+                System.out.printf(\"%d개 일치 (%d원) - %d개\\n\", rank.getCount(), rank.getPrizeMoney(), list.size());\n+\n+                sum += rank.getPrizeMoney() * list.size();\n+            } else{\n+                System.out.printf(\"%d개 일치 (%d원) - 0개\\n\", rank.getCount(), rank.getPrizeMoney());\n+            }\n+        }","path":"src/main/java/joont92/LottoMachine.java","position":94,"original_position":94,"commit_id":"320dd02c196b1a10bad806986f17c49113a50489","original_commit_id":"320dd02c196b1a10bad806986f17c49113a50489","user":{"login":"beadss","id":17905976,"avatar_url":"https://avatars1.githubusercontent.com/u/17905976?v=4","gravatar_id":"","url":"https://api.github.com/users/beadss","html_url":"https://github.com/beadss","followers_url":"https://api.github.com/users/beadss/followers","following_url":"https://api.github.com/users/beadss/following{/other_user}","gists_url":"https://api.github.com/users/beadss/gists{/gist_id}","starred_url":"https://api.github.com/users/beadss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beadss/subscriptions","organizations_url":"https://api.github.com/users/beadss/orgs","repos_url":"https://api.github.com/users/beadss/repos","events_url":"https://api.github.com/users/beadss/events{/privacy}","received_events_url":"https://api.github.com/users/beadss/received_events","type":"User","site_admin":false},"body":"stream에는 else라는 개념이 잘 어울리지 않는 것 같습니다.\r\n동일한 흐름으로 갈 수 있도록 처리하면, 이 코드도 stream으로 변경하기 좋을 것 같습니다.\r\n","created_at":"2018-04-03T06:53:29Z","updated_at":"2018-04-03T06:53:34Z","html_url":"https://github.com/beadss/java8-study/pull/1#discussion_r178728478","pull_request_url":"https://api.github.com/repos/beadss/java8-study/pulls/1","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/comments/178728478"},"html":{"href":"https://github.com/beadss/java8-study/pull/1#discussion_r178728478"},"pull_request":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/1"}},"in_reply_to_id":176793440},"pull_request":{"url":"https://api.github.com/repos/beadss/java8-study/pulls/1","id":177101792,"html_url":"https://github.com/beadss/java8-study/pull/1","diff_url":"https://github.com/beadss/java8-study/pull/1.diff","patch_url":"https://github.com/beadss/java8-study/pull/1.patch","issue_url":"https://api.github.com/repos/beadss/java8-study/issues/1","number":1,"state":"open","locked":false,"title":"Joont92","user":{"login":"joont92","id":18513953,"avatar_url":"https://avatars2.githubusercontent.com/u/18513953?v=4","gravatar_id":"","url":"https://api.github.com/users/joont92","html_url":"https://github.com/joont92","followers_url":"https://api.github.com/users/joont92/followers","following_url":"https://api.github.com/users/joont92/following{/other_user}","gists_url":"https://api.github.com/users/joont92/gists{/gist_id}","starred_url":"https://api.github.com/users/joont92/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joont92/subscriptions","organizations_url":"https://api.github.com/users/joont92/orgs","repos_url":"https://api.github.com/users/joont92/repos","events_url":"https://api.github.com/users/joont92/events{/privacy}","received_events_url":"https://api.github.com/users/joont92/received_events","type":"User","site_admin":false},"body":"1차 요구사항 구현","created_at":"2018-03-23T15:20:38Z","updated_at":"2018-04-03T06:53:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"987777ae6d4c1def30e21924ad47aacc5e3767e7","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/beadss/java8-study/pulls/1/commits","review_comments_url":"https://api.github.com/repos/beadss/java8-study/pulls/1/comments","review_comment_url":"https://api.github.com/repos/beadss/java8-study/pulls/comments{/number}","comments_url":"https://api.github.com/repos/beadss/java8-study/issues/1/comments","statuses_url":"https://api.github.com/repos/beadss/java8-study/statuses/320dd02c196b1a10bad806986f17c49113a50489","head":{"label":"beadss:joont92","ref":"joont92","sha":"320dd02c196b1a10bad806986f17c49113a50489","user":{"login":"beadss","id":17905976,"avatar_url":"https://avatars1.githubusercontent.com/u/17905976?v=4","gravatar_id":"","url":"https://api.github.com/users/beadss","html_url":"https://github.com/beadss","followers_url":"https://api.github.com/users/beadss/followers","following_url":"https://api.github.com/users/beadss/following{/other_user}","gists_url":"https://api.github.com/users/beadss/gists{/gist_id}","starred_url":"https://api.github.com/users/beadss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beadss/subscriptions","organizations_url":"https://api.github.com/users/beadss/orgs","repos_url":"https://api.github.com/users/beadss/repos","events_url":"https://api.github.com/users/beadss/events{/privacy}","received_events_url":"https://api.github.com/users/beadss/received_events","type":"User","site_admin":false},"repo":{"id":125602526,"name":"java8-study","full_name":"beadss/java8-study","owner":{"login":"beadss","id":17905976,"avatar_url":"https://avatars1.githubusercontent.com/u/17905976?v=4","gravatar_id":"","url":"https://api.github.com/users/beadss","html_url":"https://github.com/beadss","followers_url":"https://api.github.com/users/beadss/followers","following_url":"https://api.github.com/users/beadss/following{/other_user}","gists_url":"https://api.github.com/users/beadss/gists{/gist_id}","starred_url":"https://api.github.com/users/beadss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beadss/subscriptions","organizations_url":"https://api.github.com/users/beadss/orgs","repos_url":"https://api.github.com/users/beadss/repos","events_url":"https://api.github.com/users/beadss/events{/privacy}","received_events_url":"https://api.github.com/users/beadss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/beadss/java8-study","description":null,"fork":false,"url":"https://api.github.com/repos/beadss/java8-study","forks_url":"https://api.github.com/repos/beadss/java8-study/forks","keys_url":"https://api.github.com/repos/beadss/java8-study/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beadss/java8-study/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beadss/java8-study/teams","hooks_url":"https://api.github.com/repos/beadss/java8-study/hooks","issue_events_url":"https://api.github.com/repos/beadss/java8-study/issues/events{/number}","events_url":"https://api.github.com/repos/beadss/java8-study/events","assignees_url":"https://api.github.com/repos/beadss/java8-study/assignees{/user}","branches_url":"https://api.github.com/repos/beadss/java8-study/branches{/branch}","tags_url":"https://api.github.com/repos/beadss/java8-study/tags","blobs_url":"https://api.github.com/repos/beadss/java8-study/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beadss/java8-study/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beadss/java8-study/git/refs{/sha}","trees_url":"https://api.github.com/repos/beadss/java8-study/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beadss/java8-study/statuses/{sha}","languages_url":"https://api.github.com/repos/beadss/java8-study/languages","stargazers_url":"https://api.github.com/repos/beadss/java8-study/stargazers","contributors_url":"https://api.github.com/repos/beadss/java8-study/contributors","subscribers_url":"https://api.github.com/repos/beadss/java8-study/subscribers","subscription_url":"https://api.github.com/repos/beadss/java8-study/subscription","commits_url":"https://api.github.com/repos/beadss/java8-study/commits{/sha}","git_commits_url":"https://api.github.com/repos/beadss/java8-study/git/commits{/sha}","comments_url":"https://api.github.com/repos/beadss/java8-study/comments{/number}","issue_comment_url":"https://api.github.com/repos/beadss/java8-study/issues/comments{/number}","contents_url":"https://api.github.com/repos/beadss/java8-study/contents/{+path}","compare_url":"https://api.github.com/repos/beadss/java8-study/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beadss/java8-study/merges","archive_url":"https://api.github.com/repos/beadss/java8-study/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beadss/java8-study/downloads","issues_url":"https://api.github.com/repos/beadss/java8-study/issues{/number}","pulls_url":"https://api.github.com/repos/beadss/java8-study/pulls{/number}","milestones_url":"https://api.github.com/repos/beadss/java8-study/milestones{/number}","notifications_url":"https://api.github.com/repos/beadss/java8-study/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beadss/java8-study/labels{/name}","releases_url":"https://api.github.com/repos/beadss/java8-study/releases{/id}","deployments_url":"https://api.github.com/repos/beadss/java8-study/deployments","created_at":"2018-03-17T06:17:57Z","updated_at":"2018-04-03T06:31:02Z","pushed_at":"2018-03-31T04:58:01Z","git_url":"git://github.com/beadss/java8-study.git","ssh_url":"git@github.com:beadss/java8-study.git","clone_url":"https://github.com/beadss/java8-study.git","svn_url":"https://github.com/beadss/java8-study","homepage":null,"size":17,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":4,"default_branch":"master"}},"base":{"label":"beadss:master","ref":"master","sha":"13fc151b5c2657f6331876f688ab655230876e9a","user":{"login":"beadss","id":17905976,"avatar_url":"https://avatars1.githubusercontent.com/u/17905976?v=4","gravatar_id":"","url":"https://api.github.com/users/beadss","html_url":"https://github.com/beadss","followers_url":"https://api.github.com/users/beadss/followers","following_url":"https://api.github.com/users/beadss/following{/other_user}","gists_url":"https://api.github.com/users/beadss/gists{/gist_id}","starred_url":"https://api.github.com/users/beadss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beadss/subscriptions","organizations_url":"https://api.github.com/users/beadss/orgs","repos_url":"https://api.github.com/users/beadss/repos","events_url":"https://api.github.com/users/beadss/events{/privacy}","received_events_url":"https://api.github.com/users/beadss/received_events","type":"User","site_admin":false},"repo":{"id":125602526,"name":"java8-study","full_name":"beadss/java8-study","owner":{"login":"beadss","id":17905976,"avatar_url":"https://avatars1.githubusercontent.com/u/17905976?v=4","gravatar_id":"","url":"https://api.github.com/users/beadss","html_url":"https://github.com/beadss","followers_url":"https://api.github.com/users/beadss/followers","following_url":"https://api.github.com/users/beadss/following{/other_user}","gists_url":"https://api.github.com/users/beadss/gists{/gist_id}","starred_url":"https://api.github.com/users/beadss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beadss/subscriptions","organizations_url":"https://api.github.com/users/beadss/orgs","repos_url":"https://api.github.com/users/beadss/repos","events_url":"https://api.github.com/users/beadss/events{/privacy}","received_events_url":"https://api.github.com/users/beadss/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/beadss/java8-study","description":null,"fork":false,"url":"https://api.github.com/repos/beadss/java8-study","forks_url":"https://api.github.com/repos/beadss/java8-study/forks","keys_url":"https://api.github.com/repos/beadss/java8-study/keys{/key_id}","collaborators_url":"https://api.github.com/repos/beadss/java8-study/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/beadss/java8-study/teams","hooks_url":"https://api.github.com/repos/beadss/java8-study/hooks","issue_events_url":"https://api.github.com/repos/beadss/java8-study/issues/events{/number}","events_url":"https://api.github.com/repos/beadss/java8-study/events","assignees_url":"https://api.github.com/repos/beadss/java8-study/assignees{/user}","branches_url":"https://api.github.com/repos/beadss/java8-study/branches{/branch}","tags_url":"https://api.github.com/repos/beadss/java8-study/tags","blobs_url":"https://api.github.com/repos/beadss/java8-study/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/beadss/java8-study/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/beadss/java8-study/git/refs{/sha}","trees_url":"https://api.github.com/repos/beadss/java8-study/git/trees{/sha}","statuses_url":"https://api.github.com/repos/beadss/java8-study/statuses/{sha}","languages_url":"https://api.github.com/repos/beadss/java8-study/languages","stargazers_url":"https://api.github.com/repos/beadss/java8-study/stargazers","contributors_url":"https://api.github.com/repos/beadss/java8-study/contributors","subscribers_url":"https://api.github.com/repos/beadss/java8-study/subscribers","subscription_url":"https://api.github.com/repos/beadss/java8-study/subscription","commits_url":"https://api.github.com/repos/beadss/java8-study/commits{/sha}","git_commits_url":"https://api.github.com/repos/beadss/java8-study/git/commits{/sha}","comments_url":"https://api.github.com/repos/beadss/java8-study/comments{/number}","issue_comment_url":"https://api.github.com/repos/beadss/java8-study/issues/comments{/number}","contents_url":"https://api.github.com/repos/beadss/java8-study/contents/{+path}","compare_url":"https://api.github.com/repos/beadss/java8-study/compare/{base}...{head}","merges_url":"https://api.github.com/repos/beadss/java8-study/merges","archive_url":"https://api.github.com/repos/beadss/java8-study/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/beadss/java8-study/downloads","issues_url":"https://api.github.com/repos/beadss/java8-study/issues{/number}","pulls_url":"https://api.github.com/repos/beadss/java8-study/pulls{/number}","milestones_url":"https://api.github.com/repos/beadss/java8-study/milestones{/number}","notifications_url":"https://api.github.com/repos/beadss/java8-study/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/beadss/java8-study/labels{/name}","releases_url":"https://api.github.com/repos/beadss/java8-study/releases{/id}","deployments_url":"https://api.github.com/repos/beadss/java8-study/deployments","created_at":"2018-03-17T06:17:57Z","updated_at":"2018-04-03T06:31:02Z","pushed_at":"2018-03-31T04:58:01Z","git_url":"git://github.com/beadss/java8-study.git","ssh_url":"git@github.com:beadss/java8-study.git","clone_url":"https://github.com/beadss/java8-study.git","svn_url":"https://github.com/beadss/java8-study","homepage":null,"size":17,"stargazers_count":4,"watchers_count":4,"language":"Java","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":0,"open_issues":4,"watchers":4,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/1"},"html":{"href":"https://github.com/beadss/java8-study/pull/1"},"issue":{"href":"https://api.github.com/repos/beadss/java8-study/issues/1"},"comments":{"href":"https://api.github.com/repos/beadss/java8-study/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/beadss/java8-study/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/beadss/java8-study/statuses/320dd02c196b1a10bad806986f17c49113a50489"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"beadss"}}