Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Hammer2019-05-12 10:18:00 -0400
committerMichael Keppler2019-05-25 01:27:08 -0400
commit4334109a7e8e97a87951023f47312a0aac49c9a8 (patch)
tree73b5046a39c473f67b6dce6074210be60f705312 /org.eclipse.egit.ui/src/org/eclipse
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/src/org/eclipse')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java4
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java5
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java5
3 files changed, 6 insertions, 8 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
index 957917ecd..922c82da9 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/UIUtils.java
@@ -14,6 +14,7 @@ package org.eclipse.egit.ui;
import java.lang.ref.SoftReference;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
@@ -476,8 +477,7 @@ public class UIUtils {
List<String> values = new ArrayList<>(
existingValues.length + 1);
- for (String existingValue : existingValues)
- values.add(existingValue);
+ values.addAll(Arrays.asList(existingValues));
// if it is already the first value, we don't need to do
// anything
if (values.indexOf(value) == 0)
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
index 7b55ea278..fef6977f6 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/components/CachedCheckboxTreeViewer.java
@@ -13,6 +13,7 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.components;
+import java.util.Arrays;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
@@ -198,9 +199,7 @@ public class CachedCheckboxTreeViewer extends ContainerCheckedTreeViewer {
}
if (contentProvider == null) {
- for (Object element : visible) {
- checkState.add(element);
- }
+ checkState.addAll(Arrays.asList(visible));
} else {
Set<Object> toCheck = new HashSet<>();
for (Object element : visible) {
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
index 2a07f4f4b..f187138ad 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/dialogs/HyperlinkTokenScanner.java
@@ -11,6 +11,7 @@
package org.eclipse.egit.ui.internal.dialogs;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Iterator;
@@ -304,9 +305,7 @@ public class HyperlinkTokenScanner implements ITokenScanner {
IHyperlinkDetector[] configuredDetectors = configuration
.getHyperlinkDetectors(viewer);
if (configuredDetectors != null && configuredDetectors.length > 0) {
- for (IHyperlinkDetector detector : configuredDetectors) {
- allDetectors.add(detector);
- }
+ allDetectors.addAll(Arrays.asList(configuredDetectors));
if (preferenceStore.getBoolean(URL_HYPERLINK_DETECTOR_KEY)
|| !preferenceStore.getBoolean(
AbstractTextEditor.PREFERENCE_HYPERLINKS_ENABLED)) {

Back to the top