From 74bc50125d3a2cb0a7eb8c32118b3f9a9530a361 Mon Sep 17 00:00:00 2001 From: Carsten Hammer Date: Tue, 21 May 2019 17:04:18 +0200 Subject: 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 Signed-off-by: Matthias Sohn --- .../src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'org.eclipse.jgit.ui/src') diff --git a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java index edf94cff44..22409a3b6d 100644 --- a/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java +++ b/org.eclipse.jgit.ui/src/org/eclipse/jgit/awtui/AwtCredentialsProvider.java @@ -108,10 +108,10 @@ public class AwtCredentialsProvider extends CredentialsProvider { @Override public boolean get(URIish uri, CredentialItem... items) throws UnsupportedCredentialItem { - if (items.length == 0) { + switch (items.length) { + case 0: return true; - - } else if (items.length == 1) { + case 1: final CredentialItem item = items[0]; if (item instanceof CredentialItem.InformationalMessage) { @@ -141,8 +141,7 @@ public class AwtCredentialsProvider extends CredentialsProvider { } else { return interactive(uri, items); } - - } else { + default: return interactive(uri, items); } } -- cgit v1.2.3