diff options
7 files changed, 16 insertions, 17 deletions
diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java index 7d8f3fd39c..4246fbe3bc 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/internal/transport/sshd/OpenSshServerKeyVerifier.java @@ -60,6 +60,7 @@ import java.nio.file.Paths; import java.security.GeneralSecurityException; import java.security.PublicKey; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.LinkedList; @@ -586,9 +587,7 @@ public class OpenSshServerKeyVerifier KeyUtils.getFingerPrint(BuiltinDigests.sha256, expected), KeyUtils.getFingerPrint(BuiltinDigests.md5, actual), KeyUtils.getFingerPrint(BuiltinDigests.sha256, actual)); - for (String line : warning.split("\n")) { //$NON-NLS-1$ - messages.add(line); - } + messages.addAll(Arrays.asList(warning.split("\n"))); //$NON-NLS-1$ CredentialsProvider provider = getCredentialsProvider( clientSession); diff --git a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java index 5a01eae9b5..e6100e225d 100644 --- a/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java +++ b/org.eclipse.jgit.test/src/org/eclipse/jgit/lib/Sets.java @@ -43,6 +43,7 @@ package org.eclipse.jgit.lib; +import java.util.Arrays; import java.util.HashSet; import java.util.Set; @@ -50,8 +51,7 @@ public class Sets { @SafeVarargs public static <T> Set<T> of(T... elements) { Set<T> ret = new HashSet<>(); - for (T element : elements) - ret.add(element); + ret.addAll(Arrays.asList(elements)); return ret; } } diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java index 1d9cd78140..d6aead4a52 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/TreeWalkAttributeTest.java @@ -49,6 +49,7 @@ import static org.junit.Assert.assertTrue; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashSet; @@ -854,8 +855,7 @@ public class TreeWalkAttributeTest extends RepositoryTestCase { static Set<Attribute> asSet(Attribute... attrs) { HashSet<Attribute> result = new HashSet<>(); - for (Attribute attr : attrs) - result.add(attr); + result.addAll(Arrays.asList(attrs)); return result; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java index 31e7281d64..c3feaeffca 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java @@ -46,6 +46,7 @@ package org.eclipse.jgit.api; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -188,8 +189,7 @@ public class DeleteBranchCommand extends GitCommand<List<String>> { public DeleteBranchCommand setBranchNames(String... branchnames) { checkCallable(); this.branchNames.clear(); - for (String branch : branchnames) - this.branchNames.add(branch); + this.branchNames.addAll(Arrays.asList(branchnames)); return this; } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java index 63a090cafc..1970240621 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java @@ -45,6 +45,7 @@ package org.eclipse.jgit.api; import java.io.IOException; import java.text.MessageFormat; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -135,8 +136,7 @@ public class DeleteTagCommand extends GitCommand<List<String>> { public DeleteTagCommand setTags(String... tags) { checkCallable(); this.tags.clear(); - for (String tagName : tags) - this.tags.add(tagName); + this.tags.addAll(Arrays.asList(tags)); return this; } } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java index c67c44b216..c3dc3dea66 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java @@ -44,6 +44,7 @@ package org.eclipse.jgit.revwalk.filter; import java.io.IOException; +import java.util.Arrays; import org.eclipse.jgit.errors.IncorrectObjectTypeException; import org.eclipse.jgit.errors.MissingObjectException; @@ -78,8 +79,7 @@ public abstract class RevFlagFilter extends RevFilter { */ public static RevFilter hasAll(RevFlag... a) { final RevFlagSet set = new RevFlagSet(); - for (RevFlag flag : a) - set.add(flag); + set.addAll(Arrays.asList(a)); return new HasAll(set); } @@ -103,8 +103,7 @@ public abstract class RevFlagFilter extends RevFilter { */ public static RevFilter hasAny(RevFlag... a) { final RevFlagSet set = new RevFlagSet(); - for (RevFlag flag : a) - set.add(flag); + set.addAll(Arrays.asList(a)); return new HasAny(set); } diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java index c1ec19e8fb..20a5d9da72 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java @@ -53,6 +53,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.MessageFormat; +import java.util.Arrays; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Set; @@ -214,8 +215,8 @@ abstract class BasePackConnection extends BaseConnection { if (nul >= 0) { // The first line (if any) may contain "hidden" // capability values after a NUL byte. - for (String c : line.substring(nul + 1).split(" ")) //$NON-NLS-1$ - remoteCapablities.add(c); + remoteCapablities.addAll( + Arrays.asList(line.substring(nul + 1).split(" "))); //$NON-NLS-1$ line = line.substring(0, nul); } } |