Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikaƫl Barbero2013-09-30 11:02:56 +0000
committerGerrit Code Review @ Eclipse.org2013-09-30 12:37:48 +0000
commit01082b1d50a403597dcc4fc4f5982c69b8724b2d (patch)
tree7f135d9a6dffcbe560fbe9950defcc84fedec10f
parent78a0088efbf6ad5cb2ddfef58665c101660b95aa (diff)
downloadorg.eclipse.emf.compare-01082b1d50a403597dcc4fc4f5982c69b8724b2d.tar.gz
org.eclipse.emf.compare-01082b1d50a403597dcc4fc4f5982c69b8724b2d.tar.xz
org.eclipse.emf.compare-01082b1d50a403597dcc4fc4f5982c69b8724b2d.zip
Remove unnecessary loop to copy an iterable
-rw-r--r--plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/DifferenceGroupRegistryImpl.java24
1 files changed, 9 insertions, 15 deletions
diff --git a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/DifferenceGroupRegistryImpl.java b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/DifferenceGroupRegistryImpl.java
index 58f93f3df..04c93aa4e 100644
--- a/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/DifferenceGroupRegistryImpl.java
+++ b/plugins/org.eclipse.emf.compare.rcp.ui/src/org/eclipse/emf/compare/rcp/ui/internal/structuremergeviewer/groups/impl/DifferenceGroupRegistryImpl.java
@@ -11,10 +11,10 @@
package org.eclipse.emf.compare.rcp.ui.internal.structuremergeviewer.groups.impl;
import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Lists.newArrayList;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
+import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.Map;
@@ -47,28 +47,22 @@ public class DifferenceGroupRegistryImpl implements Registry {
* Comparison)
*/
public List<IDifferenceGroupProvider> getGroupProviders(IComparisonScope scope, Comparison comparison) {
- Iterable<IDifferenceGroupProvider> providers = filter(map.values(), isGroupProviderActivable(
- scope, comparison));
- List<IDifferenceGroupProvider> ret = newArrayList();
- for (IDifferenceGroupProvider provider : providers) {
- ret.add(provider);
- }
- return ret;
+ Iterable<IDifferenceGroupProvider> providers = filter(map.values(), isGroupProviderActivable(scope,
+ comparison));
+ return ImmutableList.copyOf(providers);
}
/**
- * Returns a predicate that represents the activation condition based on the scope and comparison
- * objects.
+ * Returns a predicate that represents the activation condition based on the scope and comparison objects.
*
* @param scope
* The scope on which the group provider will be applied.
* @param comparison
* The comparison which is to be displayed in the structural view.
- * @return A predicate that represents the activation condition based on the scope and comparison
- * objects.
+ * @return A predicate that represents the activation condition based on the scope and comparison objects.
*/
- static final Predicate<IDifferenceGroupProvider> isGroupProviderActivable(
- final IComparisonScope scope, final Comparison comparison) {
+ static final Predicate<IDifferenceGroupProvider> isGroupProviderActivable(final IComparisonScope scope,
+ final Comparison comparison) {
return new Predicate<IDifferenceGroupProvider>() {
/**
* {@inheritDoc}
@@ -110,4 +104,4 @@ public class DifferenceGroupRegistryImpl implements Registry {
public void clear() {
map.clear();
}
-} \ No newline at end of file
+}

Back to the top