summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorCarsten Hammer <carsten.hammer@t-online.de>2019-04-06 20:42:38 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2019-04-14 00:19:51 +0200
commit0b320b2c357a02d1f7306cb572e09917a4ec59d9 (patch)
treee70d0265c538e9f284023d7fe177d0ddca5c67b8 /org.eclipse.jgit
parent39b0b51b1253f569888db3578b01708a14360b69 (diff)
downloadjgit-0b320b2c357a02d1f7306cb572e09917a4ec59d9.tar.gz
jgit-0b320b2c357a02d1f7306cb572e09917a4ec59d9.zip
Use Arrays.asList instead of copying array in a for loop
Change-Id: Ie44950f7d2f2f94a0412efb6c274f6e1e31efcd6 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')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteBranchCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/DeleteTagCommand.java4
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/revwalk/filter/RevFlagFilter.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/BasePackConnection.java5
4 files changed, 10 insertions, 10 deletions
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);
}
}