CommentDetail: Rewrite switch statement in include method with if + else Change-Id: Ice480cab292327d1982afe2f81c167723e8e8363 Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java b/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java index eb11778..fa282ca 100644 --- a/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java +++ b/gerrit-common/src/main/java/com/google/gerrit/common/data/CommentDetail.java
@@ -45,20 +45,16 @@ public void include(Change.Id changeId, Comment p) { PatchSet.Id psId = new PatchSet.Id(changeId, p.key.patchSetId); - switch (p.side) { - case 0: - if (idA == null && idB.equals(psId)) { - a.add(p); - } - break; - - case 1: - if (idA != null && idA.equals(psId)) { - a.add(p); - } else if (idB.equals(psId)) { - b.add(p); - } - break; + if (p.side == 0) { + if (idA == null && idB.equals(psId)) { + a.add(p); + } + } else if (p.side == 1) { + if (idA != null && idA.equals(psId)) { + a.add(p); + } else if (idB.equals(psId)) { + b.add(p); + } } }