Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-05-12 14:18:00 +0000
committerMichael Keppler2019-05-25 05:27:08 +0000
commit4334109a7e8e97a87951023f47312a0aac49c9a8 (patch)
tree73b5046a39c473f67b6dce6074210be60f705312 /org.eclipse.egit.ui.test/src/org/eclipse/egit
parent20ccab057980d707bfe8f8f4498d92f2f95ad559 (diff)
downloadegit-4334109a7e8e97a87951023f47312a0aac49c9a8.tar.gz
egit-4334109a7e8e97a87951023f47312a0aac49c9a8.tar.xz
egit-4334109a7e8e97a87951023f47312a0aac49c9a8.zip
Use Arrays.asList instead of copying array in a for loop
Additionally remove some type declarations that are not needed. Change-Id: I2340a7c4393474015fc6bf5a4d55f245d9b330d2 Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
Diffstat (limited to 'org.eclipse.egit.ui.test/src/org/eclipse/egit')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java5
2 files changed, 6 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index d65c7d503d..2551d908e2 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -160,7 +160,7 @@ public class TestUtil {
BundleContext context = bundle.getBundleContext();
ServiceTracker<BundleLocalization, BundleLocalization> localizationTracker =
- new ServiceTracker<BundleLocalization, BundleLocalization>(
+ new ServiceTracker<>(
context, BundleLocalization.class, null);
localizationTracker.open();
@@ -469,8 +469,7 @@ public class TestUtil {
public static void assertRepositoryContainsFiles(Repository repository,
String[] paths) throws Exception {
Set<String> expectedfiles = new HashSet<>();
- for (String path : paths)
- expectedfiles.add(path);
+ expectedfiles.addAll(Arrays.asList(paths));
try (TreeWalk treeWalk = new TreeWalk(repository)) {
treeWalk.addTree(repository.resolve("HEAD^{tree}"));
treeWalk.setRecursive(true);
@@ -555,7 +554,7 @@ public class TestUtil {
*/
public SWTBotTreeItem[] getProjectItems(SWTBotTree projectExplorerTree,
String... projects) {
- List<SWTBotTreeItem> items = new ArrayList<SWTBotTreeItem>();
+ List<SWTBotTreeItem> items = new ArrayList<>();
for (SWTBotTreeItem item : projectExplorerTree.getAllItems()) {
String itemText = item.getText();
StringTokenizer tok = new StringTokenizer(itemText, " ");
@@ -691,7 +690,7 @@ public class TestUtil {
*/
public static SWTBotTreeItem getNode(SWTBotTreeItem[] nodes, String searchText) {
List<String> texts = new ArrayList<>();
- List<SWTBotTreeItem> matchingItems = new ArrayList<SWTBotTreeItem>();
+ List<SWTBotTreeItem> matchingItems = new ArrayList<>();
for (SWTBotTreeItem item : nodes) {
String text = item.getText();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
index 24737b5310..18393f8756 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/stagview/TestCommitMessageProviderExtensionFactory.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.test.stagview;
+import java.util.Arrays;
import java.util.LinkedList;
import java.util.Queue;
@@ -60,9 +61,7 @@ public class TestCommitMessageProviderExtensionFactory
public void setCommitMessageProviders(
ICommitMessageProvider... newProviders) {
providers.clear();
- for (ICommitMessageProvider p : newProviders) {
- providers.add(p);
- }
+ providers.addAll(Arrays.asList(newProviders));
}
}

Back to the top