aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java
diff options
context:
space:
mode:
authorCarsten Hammer <carsten.hammer@t-online.de>2019-05-21 17:04:18 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-12-14 20:42:03 +0100
commit74bc50125d3a2cb0a7eb8c32118b3f9a9530a361 (patch)
tree48e86457ef252be344ece68d9558f72fd23b911c /org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java
parent1b3a555f667712ece7f17f009b5444862cbac54f (diff)
downloadjgit-74bc50125d3a2cb0a7eb8c32118b3f9a9530a361.tar.gz
jgit-74bc50125d3a2cb0a7eb8c32118b3f9a9530a361.zip
Replace chain of if statements with switch
and switch over strings where possible. Sometimes if statements are chained and form a series of comparisons against constants. Using switch statements improves readability. Bug: 545856 Change-Id: Iacb78956ee5c20db4d793e6b668508ec67466606 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java b/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java
index 106737805c..4e544d18e8 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/blame/ReverseWalk.java
@@ -92,15 +92,19 @@ final class ReverseWalk extends RevWalk {
// visited first by BlameGenerator when considering candidates.
int cnt = children.length;
- if (cnt == 0)
+ switch (cnt) {
+ case 0:
children = new ReverseCommit[] { c };
- else if (cnt == 1)
+ break;
+ case 1:
children = new ReverseCommit[] { c, children[0] };
- else {
+ break;
+ default:
ReverseCommit[] n = new ReverseCommit[1 + cnt];
n[0] = c;
System.arraycopy(children, 0, n, 1, cnt);
children = n;
+ break;
}
}