{"action":"created","comment":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/33696033","id":33696033,"diff_hunk":"@@ -20,61 +20,51 @@\n \n package org.sonar.server.computation.debt;\n \n-import com.google.common.base.Optional;\n-import com.google.common.collect.ArrayListMultimap;\n-import com.google.common.collect.ImmutableSet;\n-import com.google.common.collect.Multimap;\n-import java.util.Collections;\n+import java.util.ArrayList;\n import java.util.HashMap;\n+import java.util.List;\n import java.util.Map;\n-import java.util.Set;\n \n-import static com.google.common.base.Optional.fromNullable;\n import static com.google.common.base.Preconditions.checkArgument;\n import static com.google.common.base.Preconditions.checkState;\n import static java.util.Objects.requireNonNull;\n \n public class DebtModelHolderImpl implements MutableDebtModelHolder {\n \n-  private final Multimap<Characteristic, Characteristic> subCharacteristicsByRootCharacteristic = ArrayListMultimap.create();\n-  private final Map<String, Characteristic> characteristicByKey = new HashMap<>();\n+  private final List<Characteristic> rootCharacteristics = new ArrayList<>();\n+  private final Map<Integer, Characteristic> characteristicById = new HashMap<>();\n \n   @Override\n-  public void addCharacteristics(Characteristic rootCharacteristic, Iterable<? extends Characteristic> subCharacteristics) {\n+  public DebtModelHolderImpl addCharacteristics(Characteristic rootCharacteristic, Iterable<? extends Characteristic> subCharacteristics) {\n     requireNonNull(rootCharacteristic, \"rootCharacteristic cannot be null\");\n     requireNonNull(subCharacteristics, \"subCharacteristics cannot be null\");\n     checkArgument(subCharacteristics.iterator().hasNext(), \"subCharacteristics cannot be empty\");\n-    subCharacteristicsByRootCharacteristic.putAll(rootCharacteristic, subCharacteristics);\n \n-    characteristicByKey.put(rootCharacteristic.getKey(), rootCharacteristic);\n+    rootCharacteristics.add(rootCharacteristic);\n+    characteristicById.put(rootCharacteristic.getId(), rootCharacteristic);\n     for (Characteristic characteristic : subCharacteristics) {\n-      characteristicByKey.put(characteristic.getKey(), characteristic);\n+      characteristicById.put(characteristic.getId(), characteristic);\n     }\n+    return this;\n   }\n \n   @Override\n-  public Set<Characteristic> findRootCharacteristics() {\n-    checkCharacteristicsAreInitialized();\n-    return ImmutableSet.copyOf(subCharacteristicsByRootCharacteristic.keySet());\n-  }\n-\n-  @Override\n-  public Set<Characteristic> findSubCharacteristicsByRootKey(String rootCharacteristicKey) {\n-    checkCharacteristicsAreInitialized();\n-    Characteristic rootCharacteristic = characteristicByKey.get(rootCharacteristicKey);\n-    if (rootCharacteristic == null) {\n-      return Collections.emptySet();\n+  public Characteristic getCharacteristicById(int id) {\n+    checkInitialized();\n+    Characteristic characteristic = characteristicById.get(id);\n+    if (characteristic == null) {","path":"server/sonar-server/src/main/java/org/sonar/server/computation/debt/DebtModelHolderImpl.java","position":60,"original_position":60,"commit_id":"a2d33c8d18f27349ef53953df4a70aaa89858e4d","original_commit_id":"a2d33c8d18f27349ef53953df4a70aaa89858e4d","user":{"login":"sns-seb","id":11717580,"avatar_url":"https://avatars.githubusercontent.com/u/11717580?v=3","gravatar_id":"","url":"https://api.github.com/users/sns-seb","html_url":"https://github.com/sns-seb","followers_url":"https://api.github.com/users/sns-seb/followers","following_url":"https://api.github.com/users/sns-seb/following{/other_user}","gists_url":"https://api.github.com/users/sns-seb/gists{/gist_id}","starred_url":"https://api.github.com/users/sns-seb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sns-seb/subscriptions","organizations_url":"https://api.github.com/users/sns-seb/orgs","repos_url":"https://api.github.com/users/sns-seb/repos","events_url":"https://api.github.com/users/sns-seb/events{/privacy}","received_events_url":"https://api.github.com/users/sns-seb/received_events","type":"User","site_admin":false},"body":"you could use Preconditions.checkState here","created_at":"2015-07-01T16:23:16Z","updated_at":"2015-07-01T16:23:16Z","html_url":"https://github.com/SonarSource/sonarqube/pull/404#discussion_r33696033","pull_request_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404","_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments/33696033"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/404#discussion_r33696033"},"pull_request":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404"}}},"pull_request":{"url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404","id":38989412,"html_url":"https://github.com/SonarSource/sonarqube/pull/404","diff_url":"https://github.com/SonarSource/sonarqube/pull/404.diff","patch_url":"https://github.com/SonarSource/sonarqube/pull/404.patch","issue_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/404","number":404,"state":"open","locked":false,"title":"Move issues and debt to Compute Engine","user":{"login":"simonbrandhof","id":414010,"avatar_url":"https://avatars.githubusercontent.com/u/414010?v=3","gravatar_id":"","url":"https://api.github.com/users/simonbrandhof","html_url":"https://github.com/simonbrandhof","followers_url":"https://api.github.com/users/simonbrandhof/followers","following_url":"https://api.github.com/users/simonbrandhof/following{/other_user}","gists_url":"https://api.github.com/users/simonbrandhof/gists{/gist_id}","starred_url":"https://api.github.com/users/simonbrandhof/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonbrandhof/subscriptions","organizations_url":"https://api.github.com/users/simonbrandhof/orgs","repos_url":"https://api.github.com/users/simonbrandhof/repos","events_url":"https://api.github.com/users/simonbrandhof/events{/privacy}","received_events_url":"https://api.github.com/users/simonbrandhof/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-07-01T14:44:39Z","updated_at":"2015-07-01T16:23:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"900d75aed05f0003046c9ab2c57ba2ce9c95b5ae","assignee":{"login":"sns-seb","id":11717580,"avatar_url":"https://avatars.githubusercontent.com/u/11717580?v=3","gravatar_id":"","url":"https://api.github.com/users/sns-seb","html_url":"https://github.com/sns-seb","followers_url":"https://api.github.com/users/sns-seb/followers","following_url":"https://api.github.com/users/sns-seb/following{/other_user}","gists_url":"https://api.github.com/users/sns-seb/gists{/gist_id}","starred_url":"https://api.github.com/users/sns-seb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sns-seb/subscriptions","organizations_url":"https://api.github.com/users/sns-seb/orgs","repos_url":"https://api.github.com/users/sns-seb/repos","events_url":"https://api.github.com/users/sns-seb/events{/privacy}","received_events_url":"https://api.github.com/users/sns-seb/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404/commits","review_comments_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404/comments","review_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/404/comments","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/a2d33c8d18f27349ef53953df4a70aaa89858e4d","head":{"label":"SonarSource:feature/ce_issue_tracking","ref":"feature/ce_issue_tracking","sha":"a2d33c8d18f27349ef53953df4a70aaa89858e4d","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-07-01T02:35:49Z","pushed_at":"2015-07-01T16:22:16Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":722113,"stargazers_count":655,"watchers_count":655,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":348,"mirror_url":null,"open_issues_count":9,"forks":348,"open_issues":9,"watchers":655,"default_branch":"master"}},"base":{"label":"SonarSource:master","ref":"master","sha":"9688612ce910c9e78ba768ee90a0e9f286d8234f","user":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"repo":{"id":1222504,"name":"sonarqube","full_name":"SonarSource/sonarqube","owner":{"login":"SonarSource","id":545988,"avatar_url":"https://avatars.githubusercontent.com/u/545988?v=3","gravatar_id":"","url":"https://api.github.com/users/SonarSource","html_url":"https://github.com/SonarSource","followers_url":"https://api.github.com/users/SonarSource/followers","following_url":"https://api.github.com/users/SonarSource/following{/other_user}","gists_url":"https://api.github.com/users/SonarSource/gists{/gist_id}","starred_url":"https://api.github.com/users/SonarSource/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SonarSource/subscriptions","organizations_url":"https://api.github.com/users/SonarSource/orgs","repos_url":"https://api.github.com/users/SonarSource/repos","events_url":"https://api.github.com/users/SonarSource/events{/privacy}","received_events_url":"https://api.github.com/users/SonarSource/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/SonarSource/sonarqube","description":"Put your technical debt under control","fork":false,"url":"https://api.github.com/repos/SonarSource/sonarqube","forks_url":"https://api.github.com/repos/SonarSource/sonarqube/forks","keys_url":"https://api.github.com/repos/SonarSource/sonarqube/keys{/key_id}","collaborators_url":"https://api.github.com/repos/SonarSource/sonarqube/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/SonarSource/sonarqube/teams","hooks_url":"https://api.github.com/repos/SonarSource/sonarqube/hooks","issue_events_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/events{/number}","events_url":"https://api.github.com/repos/SonarSource/sonarqube/events","assignees_url":"https://api.github.com/repos/SonarSource/sonarqube/assignees{/user}","branches_url":"https://api.github.com/repos/SonarSource/sonarqube/branches{/branch}","tags_url":"https://api.github.com/repos/SonarSource/sonarqube/tags","blobs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/SonarSource/sonarqube/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/SonarSource/sonarqube/git/refs{/sha}","trees_url":"https://api.github.com/repos/SonarSource/sonarqube/git/trees{/sha}","statuses_url":"https://api.github.com/repos/SonarSource/sonarqube/statuses/{sha}","languages_url":"https://api.github.com/repos/SonarSource/sonarqube/languages","stargazers_url":"https://api.github.com/repos/SonarSource/sonarqube/stargazers","contributors_url":"https://api.github.com/repos/SonarSource/sonarqube/contributors","subscribers_url":"https://api.github.com/repos/SonarSource/sonarqube/subscribers","subscription_url":"https://api.github.com/repos/SonarSource/sonarqube/subscription","commits_url":"https://api.github.com/repos/SonarSource/sonarqube/commits{/sha}","git_commits_url":"https://api.github.com/repos/SonarSource/sonarqube/git/commits{/sha}","comments_url":"https://api.github.com/repos/SonarSource/sonarqube/comments{/number}","issue_comment_url":"https://api.github.com/repos/SonarSource/sonarqube/issues/comments{/number}","contents_url":"https://api.github.com/repos/SonarSource/sonarqube/contents/{+path}","compare_url":"https://api.github.com/repos/SonarSource/sonarqube/compare/{base}...{head}","merges_url":"https://api.github.com/repos/SonarSource/sonarqube/merges","archive_url":"https://api.github.com/repos/SonarSource/sonarqube/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/SonarSource/sonarqube/downloads","issues_url":"https://api.github.com/repos/SonarSource/sonarqube/issues{/number}","pulls_url":"https://api.github.com/repos/SonarSource/sonarqube/pulls{/number}","milestones_url":"https://api.github.com/repos/SonarSource/sonarqube/milestones{/number}","notifications_url":"https://api.github.com/repos/SonarSource/sonarqube/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/SonarSource/sonarqube/labels{/name}","releases_url":"https://api.github.com/repos/SonarSource/sonarqube/releases{/id}","created_at":"2011-01-05T11:05:17Z","updated_at":"2015-07-01T02:35:49Z","pushed_at":"2015-07-01T16:22:16Z","git_url":"git://github.com/SonarSource/sonarqube.git","ssh_url":"git@github.com:SonarSource/sonarqube.git","clone_url":"https://github.com/SonarSource/sonarqube.git","svn_url":"https://github.com/SonarSource/sonarqube","homepage":"http://www.sonarqube.org","size":722113,"stargazers_count":655,"watchers_count":655,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":348,"mirror_url":null,"open_issues_count":9,"forks":348,"open_issues":9,"watchers":655,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404"},"html":{"href":"https://github.com/SonarSource/sonarqube/pull/404"},"issue":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/404"},"comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/issues/404/comments"},"review_comments":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404/comments"},"review_comment":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/SonarSource/sonarqube/pulls/404/commits"},"statuses":{"href":"https://api.github.com/repos/SonarSource/sonarqube/statuses/a2d33c8d18f27349ef53953df4a70aaa89858e4d"}}}}