summaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-10-12 10:46:06 +0200
committerHenri Sara <henri.sara@gmail.com>2017-10-12 11:46:06 +0300
commitc147b5d85bca3ddf30d9adbcd268066165889f37 (patch)
tree18d73bda278618004ec4a28ee62af7eb7edbeb98 /server/src
parent13d406a7086cc1546eac3fa86f6263bfb436de85 (diff)
downloadvaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.tar.gz
vaadin-framework-c147b5d85bca3ddf30d9adbcd268066165889f37.zip
Use Collection.isEmpty() (#10172)
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main/java/com/vaadin/data/provider/DataCommunicator.java2
-rw-r--r--server/src/main/java/com/vaadin/server/AbstractClientConnector.java2
-rw-r--r--server/src/main/java/com/vaadin/server/AbstractErrorMessage.java2
-rw-r--r--server/src/main/java/com/vaadin/server/ComponentSizeValidator.java2
-rw-r--r--server/src/main/java/com/vaadin/server/JsonPaintTarget.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/GridLayout.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java2
-rw-r--r--server/src/main/java/com/vaadin/ui/dnd/FileDropTarget.java2
-rw-r--r--server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java4
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java2
-rw-r--r--server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java2
13 files changed, 14 insertions, 14 deletions
diff --git a/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java b/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
index c6fd03a7a3..6fc0377a74 100644
--- a/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
+++ b/server/src/main/java/com/vaadin/data/provider/DataCommunicator.java
@@ -337,7 +337,7 @@ public class DataCommunicator<T> extends AbstractExtension {
List<T> rowsToPush = fetchItemsWithRange(offset, limit);
- if (!initial && !reset && rowsToPush.size() == 0) {
+ if (!initial && !reset && rowsToPush.isEmpty()) {
triggerReset = true;
}
diff --git a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java
index 23311dface..9086bf2cc2 100644
--- a/server/src/main/java/com/vaadin/server/AbstractClientConnector.java
+++ b/server/src/main/java/com/vaadin/server/AbstractClientConnector.java
@@ -515,7 +515,7 @@ public abstract class AbstractClientConnector
Collection<Extension> extensions = connector.getExtensions();
boolean hasComponents = connector instanceof HasComponents;
- boolean hasExtensions = extensions.size() > 0;
+ boolean hasExtensions = !extensions.isEmpty();
if (!hasComponents && !hasExtensions) {
// If has neither component nor extensions, return immutable empty
// list as iterable.
diff --git a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
index b7e439244e..6db7d270d4 100644
--- a/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
+++ b/server/src/main/java/com/vaadin/server/AbstractErrorMessage.java
@@ -121,7 +121,7 @@ public abstract class AbstractErrorMessage implements ErrorMessage {
break;
}
// if no message, combine the messages of all children
- if (null == result && null != getCauses() && getCauses().size() > 0) {
+ if (null == result && null != getCauses() && !getCauses().isEmpty()) {
StringBuilder sb = new StringBuilder();
for (ErrorMessage cause : getCauses()) {
String childMessage = cause.getFormattedHtmlMessage();
diff --git a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
index fdcb578f01..8fe7892c39 100644
--- a/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
+++ b/server/src/main/java/com/vaadin/server/ComponentSizeValidator.java
@@ -276,7 +276,7 @@ public class ComponentSizeValidator implements Serializable {
clientJSON.append(",\"widthMsg\":\"").append(msg).append("\"");
printServerError(msg, attributes, true, serverErrorStream);
}
- if (subErrors.size() > 0) {
+ if (!subErrors.isEmpty()) {
serverErrorStream.println("Sub errors >>");
clientJSON.append(", \"subErrors\" : [");
boolean first = true;
diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
index 3fef4926d3..b643fbb7a9 100644
--- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
+++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java
@@ -177,7 +177,7 @@ public class JsonPaintTarget implements PaintTarget {
"Attempted to write to a closed PaintTarget.");
}
- if (openJsonTags.size() > 0) {
+ if (!openJsonTags.isEmpty()) {
final JsonTag parent = openJsonTags.pop();
String lastTag = "";
diff --git a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java
index 22d25d8953..1a44c44cd2 100644
--- a/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java
+++ b/server/src/main/java/com/vaadin/ui/DragAndDropWrapper.java
@@ -272,7 +272,7 @@ public class DragAndDropWrapper extends CustomComponent
if (getDropHandler() != null) {
getDropHandler().getAcceptCriterion().paint(target);
}
- if (receivers != null && receivers.size() > 0) {
+ if (receivers != null && !receivers.isEmpty()) {
for (Iterator<Entry<String, ProxyReceiver>> it = receivers
.entrySet().iterator(); it.hasNext();) {
Entry<String, ProxyReceiver> entry = it.next();
diff --git a/server/src/main/java/com/vaadin/ui/GridLayout.java b/server/src/main/java/com/vaadin/ui/GridLayout.java
index 03886dd0e8..27e1835b57 100644
--- a/server/src/main/java/com/vaadin/ui/GridLayout.java
+++ b/server/src/main/java/com/vaadin/ui/GridLayout.java
@@ -1315,7 +1315,7 @@ public class GridLayout extends AbstractLayout
Element col = cols.get(column);
Component child = null;
- if (col.children().size() > 0) {
+ if (!col.children().isEmpty()) {
Element childElement = col.child(0);
child = designContext.readDesign(childElement);
alignments.put(child, DesignAttributeHandler
diff --git a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java
index da5cafb9d6..4b82f0bdbe 100644
--- a/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java
+++ b/server/src/main/java/com/vaadin/ui/components/grid/StaticSection.java
@@ -591,7 +591,7 @@ public abstract class StaticSection<ROW extends StaticSection.StaticRow<?>>
protected void readDesign(Element cellElement,
DesignContext designContext) {
if (!cellElement.hasAttr("plain-text")) {
- if (cellElement.children().size() > 0
+ if (!cellElement.children().isEmpty()
&& cellElement.child(0).tagName().contains("-")) {
setComponent(
designContext.readDesign(cellElement.child(0)));
diff --git a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
index aedd33618e..2caecda8f4 100644
--- a/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
+++ b/server/src/main/java/com/vaadin/ui/declarative/FieldBinder.java
@@ -91,7 +91,7 @@ public class FieldBinder implements Serializable {
throw new FieldBindingException("Could not get field value", e);
}
}
- if (unboundFields.size() > 0) {
+ if (!unboundFields.isEmpty()) {
getLogger().severe(
"Found unbound fields in component root :" + unboundFields);
}
diff --git a/server/src/main/java/com/vaadin/ui/dnd/FileDropTarget.java b/server/src/main/java/com/vaadin/ui/dnd/FileDropTarget.java
index 59197cbc26..9503243fd9 100644
--- a/server/src/main/java/com/vaadin/ui/dnd/FileDropTarget.java
+++ b/server/src/main/java/com/vaadin/ui/dnd/FileDropTarget.java
@@ -119,7 +119,7 @@ public class FileDropTarget<T extends AbstractComponent>
// Send upload URLs to the client if there are files to be
// uploaded
- if (urls.size() > 0) {
+ if (!urls.isEmpty()) {
getRpcProxy(FileDropTargetClientRpc.class).sendUploadUrl(urls);
}
}
diff --git a/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java b/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
index 89c95ffeb8..0092363ebd 100644
--- a/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
+++ b/server/src/test/java/com/vaadin/tests/server/componentcontainer/AddRemoveComponentTest.java
@@ -1,7 +1,7 @@
package com.vaadin.tests.server.componentcontainer;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
@@ -25,7 +25,7 @@ public class AddRemoveComponentTest {
List<Class<? extends ComponentContainer>> containerClasses = VaadinClasses
.getComponentContainersSupportingAddRemoveComponent();
- assertTrue(containerClasses.size() > 0);
+ assertFalse(containerClasses.isEmpty());
// No default constructor, special case
containerClasses.remove(CustomLayout.class);
diff --git a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
index 6bbd314761..fbc5767589 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractMultiSelectTest.java
@@ -397,7 +397,7 @@ public class AbstractMultiSelectTest<S extends AbstractMultiSelect<String>> {
}
private void verifyValueChangeEvents() {
- if (oldValues.size() > 0) {
+ if (!oldValues.isEmpty()) {
assertTrue(oldValues.get(0).isEmpty());
assertEquals(values.size(), oldValues.size());
for (int i = 0; i < oldValues.size() - 1; i++) {
diff --git a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
index d96793bf8e..6dafbfb812 100644
--- a/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
+++ b/server/src/test/java/com/vaadin/ui/AbstractSingleSelectTest.java
@@ -297,7 +297,7 @@ public class AbstractSingleSelectTest {
}
private void verifyValueChanges() {
- if (oldSelections.size() > 0) {
+ if (!oldSelections.isEmpty()) {
assertEquals(null, oldSelections.get(0));
assertEquals(selectionChanges.size(), oldSelections.size());
for (int i = 0; i < oldSelections.size() - 1; i++) {