[547629] Use isEmpty() instead of size()==0 where possible
Change-Id: I1c9f644ecabe281fb62f09ce3e064ec9d685de56
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
diff --git a/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/notify/impl/BasicNotifierImpl.java b/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/notify/impl/BasicNotifierImpl.java
index ba3ae39..c289250 100644
--- a/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/notify/impl/BasicNotifierImpl.java
+++ b/plugins/org.eclipse.emf.common/src/org/eclipse/emf/common/notify/impl/BasicNotifierImpl.java
@@ -392,7 +392,7 @@
protected boolean eBasicHasAdapters()
{
BasicEList<Adapter> eBasicAdapters = eBasicAdapters();
- return eBasicAdapters != null && eBasicAdapters.size() != 0;
+ return eBasicAdapters != null && !eBasicAdapters.isEmpty();
}
/*
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
index 73d465d..9844cfa 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java
@@ -1337,7 +1337,7 @@
public boolean addAll(int index, EStructuralFeature feature, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
@@ -1414,7 +1414,7 @@
public boolean addAll(EStructuralFeature feature, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
@@ -1488,7 +1488,7 @@
public boolean addAll(EStructuralFeature feature, int index, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
index 71aa23a..f7211f6 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
@@ -1290,7 +1290,7 @@
public boolean addAll(int index, EStructuralFeature feature, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
@@ -1364,7 +1364,7 @@
public boolean addAll(EStructuralFeature feature, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
@@ -1434,7 +1434,7 @@
public boolean addAll(EStructuralFeature feature, int index, Collection<?> collection)
{
- if (collection.size() == 0)
+ if (collection.isEmpty())
{
return false;
}
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreAnnotationValidator.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreAnnotationValidator.java
index 2369df5..fce5637 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreAnnotationValidator.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/util/EcoreAnnotationValidator.java
@@ -156,7 +156,7 @@
result.add(eClass);
}
}.doSwitch(eModelElement);
- return result.size() == 0 ? Collections.<EClass> emptyList() : Collections.singletonList(result.get(0));
+ return result.isEmpty() ? Collections.<EClass> emptyList() : Collections.singletonList(result.get(0));
}
@Override
diff --git a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
index de996be..85c1373 100644
--- a/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
+++ b/plugins/org.eclipse.emf.ecore/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
@@ -6726,7 +6726,7 @@
private static final int NONBMP_BLOCK_START = 84;
static protected RangeToken getRange(String name, boolean positive) {
- if (Token.categories.size() == 0) {
+ if (Token.categories.isEmpty()) {
synchronized (Token.categories) {
Token[] ranges = new Token[Token.categoryNames.length];
for (int i = 0; i < ranges.length; i ++) {