{"action":"created","comment":{"url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/comments/143341942","pull_request_review_id":67842147,"id":143341942,"diff_hunk":"@@ -0,0 +1,140 @@\n+package ru.spbau.sazanovich.nikita.collect.immutable\n+\n+import com.google.common.annotations.VisibleForTesting\n+\n+import scala.collection.immutable\n+import scala.collection.mutable\n+import scala.collection.mutable.ArrayBuffer\n+\n+/** Immutable covariant version of MultiSet. */\n+class MultiSet[+A] private (val elementCountList: immutable.List[(A, Int)]) {\n+\n+  import MultiSet.mergeInElementCountMap\n+\n+  /** Used for building up the elementCountMap internally. */\n+  private def this(elementCountMap: mutable.HashMap[A, Int]) = {\n+    this(immutable.List(elementCountMap.toSeq:_*))\n+  }\n+\n+  /** Returns whether there is at least one such element. */\n+  def apply[B >: A](elem: B): Boolean = {\n+    elementCountList.iterator.exists(e => e._1 == elem)\n+  }\n+\n+  /** Finds an element. */\n+  def get[B >: A](elem: B): Option[B] = {\n+    elementCountList.iterator.find(e => e._1 == elem).map(e => e._1)\n+  }\n+\n+  @VisibleForTesting\n+  private[immutable] def getCount[B >: A](elem: B): Int = {\n+    var elemCount = 0\n+    elementCountList.iterator.foreach(e => {\n+      if (e._1 == elem) {","path":"src/main/scala/ru/spbau/sazanovich/nikita/collect/immutable/MultiSet.scala","position":33,"original_position":33,"commit_id":"de9e094ccf9efcf0de08fad3fb326338565a1ce9","original_commit_id":"de9e094ccf9efcf0de08fad3fb326338565a1ce9","user":{"login":"adkozlov","id":1233785,"avatar_url":"https://avatars3.githubusercontent.com/u/1233785?v=4","gravatar_id":"","url":"https://api.github.com/users/adkozlov","html_url":"https://github.com/adkozlov","followers_url":"https://api.github.com/users/adkozlov/followers","following_url":"https://api.github.com/users/adkozlov/following{/other_user}","gists_url":"https://api.github.com/users/adkozlov/gists{/gist_id}","starred_url":"https://api.github.com/users/adkozlov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adkozlov/subscriptions","organizations_url":"https://api.github.com/users/adkozlov/orgs","repos_url":"https://api.github.com/users/adkozlov/repos","events_url":"https://api.github.com/users/adkozlov/events{/privacy}","received_events_url":"https://api.github.com/users/adkozlov/received_events","type":"User","site_admin":false},"body":"Эквивалент:\r\n```scala\r\nelementCountList.foreach {\r\n  case (e, count) if e == elem => elemCount += count\r\n}\r\n```","created_at":"2017-10-07T22:21:11Z","updated_at":"2017-10-07T22:42:44Z","html_url":"https://github.com/niksaz/spbau-scala/pull/3#discussion_r143341942","pull_request_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/comments/143341942"},"html":{"href":"https://github.com/niksaz/spbau-scala/pull/3#discussion_r143341942"},"pull_request":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3","id":144091269,"html_url":"https://github.com/niksaz/spbau-scala/pull/3","diff_url":"https://github.com/niksaz/spbau-scala/pull/3.diff","patch_url":"https://github.com/niksaz/spbau-scala/pull/3.patch","issue_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/3","number":3,"state":"open","locked":false,"title":"04 checkpoint","user":{"login":"niksaz","id":13810812,"avatar_url":"https://avatars3.githubusercontent.com/u/13810812?v=4","gravatar_id":"","url":"https://api.github.com/users/niksaz","html_url":"https://github.com/niksaz","followers_url":"https://api.github.com/users/niksaz/followers","following_url":"https://api.github.com/users/niksaz/following{/other_user}","gists_url":"https://api.github.com/users/niksaz/gists{/gist_id}","starred_url":"https://api.github.com/users/niksaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksaz/subscriptions","organizations_url":"https://api.github.com/users/niksaz/orgs","repos_url":"https://api.github.com/users/niksaz/repos","events_url":"https://api.github.com/users/niksaz/events{/privacy}","received_events_url":"https://api.github.com/users/niksaz/received_events","type":"User","site_admin":false},"body":"MultiSet implementations: Mutable & Immutable ones.","created_at":"2017-10-01T22:18:58Z","updated_at":"2017-10-07T22:42:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"20f85dd5126e10a8c8ffdbe92aafb2edbe9b1a4b","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3/commits","review_comments_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3/comments","review_comment_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls/comments{/number}","comments_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/3/comments","statuses_url":"https://api.github.com/repos/niksaz/spbau-scala/statuses/de9e094ccf9efcf0de08fad3fb326338565a1ce9","head":{"label":"niksaz:04-checkpoint","ref":"04-checkpoint","sha":"de9e094ccf9efcf0de08fad3fb326338565a1ce9","user":{"login":"niksaz","id":13810812,"avatar_url":"https://avatars3.githubusercontent.com/u/13810812?v=4","gravatar_id":"","url":"https://api.github.com/users/niksaz","html_url":"https://github.com/niksaz","followers_url":"https://api.github.com/users/niksaz/followers","following_url":"https://api.github.com/users/niksaz/following{/other_user}","gists_url":"https://api.github.com/users/niksaz/gists{/gist_id}","starred_url":"https://api.github.com/users/niksaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksaz/subscriptions","organizations_url":"https://api.github.com/users/niksaz/orgs","repos_url":"https://api.github.com/users/niksaz/repos","events_url":"https://api.github.com/users/niksaz/events{/privacy}","received_events_url":"https://api.github.com/users/niksaz/received_events","type":"User","site_admin":false},"repo":{"id":102661219,"name":"spbau-scala","full_name":"niksaz/spbau-scala","owner":{"login":"niksaz","id":13810812,"avatar_url":"https://avatars3.githubusercontent.com/u/13810812?v=4","gravatar_id":"","url":"https://api.github.com/users/niksaz","html_url":"https://github.com/niksaz","followers_url":"https://api.github.com/users/niksaz/followers","following_url":"https://api.github.com/users/niksaz/following{/other_user}","gists_url":"https://api.github.com/users/niksaz/gists{/gist_id}","starred_url":"https://api.github.com/users/niksaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksaz/subscriptions","organizations_url":"https://api.github.com/users/niksaz/orgs","repos_url":"https://api.github.com/users/niksaz/repos","events_url":"https://api.github.com/users/niksaz/events{/privacy}","received_events_url":"https://api.github.com/users/niksaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/niksaz/spbau-scala","description":"Alternative JVM languages course, Fall 2017","fork":false,"url":"https://api.github.com/repos/niksaz/spbau-scala","forks_url":"https://api.github.com/repos/niksaz/spbau-scala/forks","keys_url":"https://api.github.com/repos/niksaz/spbau-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/niksaz/spbau-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/niksaz/spbau-scala/teams","hooks_url":"https://api.github.com/repos/niksaz/spbau-scala/hooks","issue_events_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/events{/number}","events_url":"https://api.github.com/repos/niksaz/spbau-scala/events","assignees_url":"https://api.github.com/repos/niksaz/spbau-scala/assignees{/user}","branches_url":"https://api.github.com/repos/niksaz/spbau-scala/branches{/branch}","tags_url":"https://api.github.com/repos/niksaz/spbau-scala/tags","blobs_url":"https://api.github.com/repos/niksaz/spbau-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/niksaz/spbau-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/niksaz/spbau-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/niksaz/spbau-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/niksaz/spbau-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/niksaz/spbau-scala/languages","stargazers_url":"https://api.github.com/repos/niksaz/spbau-scala/stargazers","contributors_url":"https://api.github.com/repos/niksaz/spbau-scala/contributors","subscribers_url":"https://api.github.com/repos/niksaz/spbau-scala/subscribers","subscription_url":"https://api.github.com/repos/niksaz/spbau-scala/subscription","commits_url":"https://api.github.com/repos/niksaz/spbau-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/niksaz/spbau-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/niksaz/spbau-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/niksaz/spbau-scala/contents/{+path}","compare_url":"https://api.github.com/repos/niksaz/spbau-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/niksaz/spbau-scala/merges","archive_url":"https://api.github.com/repos/niksaz/spbau-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/niksaz/spbau-scala/downloads","issues_url":"https://api.github.com/repos/niksaz/spbau-scala/issues{/number}","pulls_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/niksaz/spbau-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/niksaz/spbau-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/niksaz/spbau-scala/labels{/name}","releases_url":"https://api.github.com/repos/niksaz/spbau-scala/releases{/id}","deployments_url":"https://api.github.com/repos/niksaz/spbau-scala/deployments","created_at":"2017-09-06T21:43:07Z","updated_at":"2017-09-17T19:12:27Z","pushed_at":"2017-10-03T09:34:44Z","git_url":"git://github.com/niksaz/spbau-scala.git","ssh_url":"git@github.com:niksaz/spbau-scala.git","clone_url":"https://github.com/niksaz/spbau-scala.git","svn_url":"https://github.com/niksaz/spbau-scala","homepage":"","size":2846,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"niksaz:master","ref":"master","sha":"d2e874bec5bad8f97bea33f1c8a52ee4bec53d8e","user":{"login":"niksaz","id":13810812,"avatar_url":"https://avatars3.githubusercontent.com/u/13810812?v=4","gravatar_id":"","url":"https://api.github.com/users/niksaz","html_url":"https://github.com/niksaz","followers_url":"https://api.github.com/users/niksaz/followers","following_url":"https://api.github.com/users/niksaz/following{/other_user}","gists_url":"https://api.github.com/users/niksaz/gists{/gist_id}","starred_url":"https://api.github.com/users/niksaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksaz/subscriptions","organizations_url":"https://api.github.com/users/niksaz/orgs","repos_url":"https://api.github.com/users/niksaz/repos","events_url":"https://api.github.com/users/niksaz/events{/privacy}","received_events_url":"https://api.github.com/users/niksaz/received_events","type":"User","site_admin":false},"repo":{"id":102661219,"name":"spbau-scala","full_name":"niksaz/spbau-scala","owner":{"login":"niksaz","id":13810812,"avatar_url":"https://avatars3.githubusercontent.com/u/13810812?v=4","gravatar_id":"","url":"https://api.github.com/users/niksaz","html_url":"https://github.com/niksaz","followers_url":"https://api.github.com/users/niksaz/followers","following_url":"https://api.github.com/users/niksaz/following{/other_user}","gists_url":"https://api.github.com/users/niksaz/gists{/gist_id}","starred_url":"https://api.github.com/users/niksaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/niksaz/subscriptions","organizations_url":"https://api.github.com/users/niksaz/orgs","repos_url":"https://api.github.com/users/niksaz/repos","events_url":"https://api.github.com/users/niksaz/events{/privacy}","received_events_url":"https://api.github.com/users/niksaz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/niksaz/spbau-scala","description":"Alternative JVM languages course, Fall 2017","fork":false,"url":"https://api.github.com/repos/niksaz/spbau-scala","forks_url":"https://api.github.com/repos/niksaz/spbau-scala/forks","keys_url":"https://api.github.com/repos/niksaz/spbau-scala/keys{/key_id}","collaborators_url":"https://api.github.com/repos/niksaz/spbau-scala/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/niksaz/spbau-scala/teams","hooks_url":"https://api.github.com/repos/niksaz/spbau-scala/hooks","issue_events_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/events{/number}","events_url":"https://api.github.com/repos/niksaz/spbau-scala/events","assignees_url":"https://api.github.com/repos/niksaz/spbau-scala/assignees{/user}","branches_url":"https://api.github.com/repos/niksaz/spbau-scala/branches{/branch}","tags_url":"https://api.github.com/repos/niksaz/spbau-scala/tags","blobs_url":"https://api.github.com/repos/niksaz/spbau-scala/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/niksaz/spbau-scala/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/niksaz/spbau-scala/git/refs{/sha}","trees_url":"https://api.github.com/repos/niksaz/spbau-scala/git/trees{/sha}","statuses_url":"https://api.github.com/repos/niksaz/spbau-scala/statuses/{sha}","languages_url":"https://api.github.com/repos/niksaz/spbau-scala/languages","stargazers_url":"https://api.github.com/repos/niksaz/spbau-scala/stargazers","contributors_url":"https://api.github.com/repos/niksaz/spbau-scala/contributors","subscribers_url":"https://api.github.com/repos/niksaz/spbau-scala/subscribers","subscription_url":"https://api.github.com/repos/niksaz/spbau-scala/subscription","commits_url":"https://api.github.com/repos/niksaz/spbau-scala/commits{/sha}","git_commits_url":"https://api.github.com/repos/niksaz/spbau-scala/git/commits{/sha}","comments_url":"https://api.github.com/repos/niksaz/spbau-scala/comments{/number}","issue_comment_url":"https://api.github.com/repos/niksaz/spbau-scala/issues/comments{/number}","contents_url":"https://api.github.com/repos/niksaz/spbau-scala/contents/{+path}","compare_url":"https://api.github.com/repos/niksaz/spbau-scala/compare/{base}...{head}","merges_url":"https://api.github.com/repos/niksaz/spbau-scala/merges","archive_url":"https://api.github.com/repos/niksaz/spbau-scala/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/niksaz/spbau-scala/downloads","issues_url":"https://api.github.com/repos/niksaz/spbau-scala/issues{/number}","pulls_url":"https://api.github.com/repos/niksaz/spbau-scala/pulls{/number}","milestones_url":"https://api.github.com/repos/niksaz/spbau-scala/milestones{/number}","notifications_url":"https://api.github.com/repos/niksaz/spbau-scala/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/niksaz/spbau-scala/labels{/name}","releases_url":"https://api.github.com/repos/niksaz/spbau-scala/releases{/id}","deployments_url":"https://api.github.com/repos/niksaz/spbau-scala/deployments","created_at":"2017-09-06T21:43:07Z","updated_at":"2017-09-17T19:12:27Z","pushed_at":"2017-10-03T09:34:44Z","git_url":"git://github.com/niksaz/spbau-scala.git","ssh_url":"git@github.com:niksaz/spbau-scala.git","clone_url":"https://github.com/niksaz/spbau-scala.git","svn_url":"https://github.com/niksaz/spbau-scala","homepage":"","size":2846,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3"},"html":{"href":"https://github.com/niksaz/spbau-scala/pull/3"},"issue":{"href":"https://api.github.com/repos/niksaz/spbau-scala/issues/3"},"comments":{"href":"https://api.github.com/repos/niksaz/spbau-scala/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/niksaz/spbau-scala/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/niksaz/spbau-scala/statuses/de9e094ccf9efcf0de08fad3fb326338565a1ce9"}},"author_association":"OWNER"}}
{"actor":{"display_login":"adkozlov"}}