From 92f1d4c34c5082bbfc8e328da78d66e6f772b704 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Per-=C3=85ke=20Minborg?= Date: Fri, 28 Oct 2016 09:01:19 -0700 Subject: [PATCH] Use Collection .isEmpty() over .size() == 0 Change-Id: I80b73b653e97904605dc62484a7448f3bfbf721f --- .../main/java/com/vaadin/server/CompositeErrorMessage.java | 4 ++-- server/src/main/java/com/vaadin/server/JsonPaintTarget.java | 2 +- server/src/main/java/com/vaadin/ui/declarative/Design.java | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/vaadin/server/CompositeErrorMessage.java b/server/src/main/java/com/vaadin/server/CompositeErrorMessage.java index 6e37a94c5e..f96bcbac27 100644 --- a/server/src/main/java/com/vaadin/server/CompositeErrorMessage.java +++ b/server/src/main/java/com/vaadin/server/CompositeErrorMessage.java @@ -43,7 +43,7 @@ public class CompositeErrorMessage extends AbstractErrorMessage { addErrorMessage(errorMessage); } - if (getCauses().size() == 0) { + if (getCauses().isEmpty()) { throw new IllegalArgumentException( "Composite error message must have at least one error"); } @@ -67,7 +67,7 @@ public class CompositeErrorMessage extends AbstractErrorMessage { addErrorMessage(i.next()); } - if (getCauses().size() == 0) { + if (getCauses().isEmpty()) { throw new IllegalArgumentException( "Composite error message must have at least one error"); } diff --git a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java index 9792673062..d5276aefaf 100644 --- a/server/src/main/java/com/vaadin/server/JsonPaintTarget.java +++ b/server/src/main/java/com/vaadin/server/JsonPaintTarget.java @@ -838,7 +838,7 @@ public class JsonPaintTarget implements PaintTarget { } private String variablesAsJsonObject() { - if (variables.size() == 0) { + if (variables.isEmpty()) { return ""; } final StringBuilder buf = new StringBuilder(); diff --git a/server/src/main/java/com/vaadin/ui/declarative/Design.java b/server/src/main/java/com/vaadin/ui/declarative/Design.java index 0c5595028e..b5b6762f20 100644 --- a/server/src/main/java/com/vaadin/ui/declarative/Design.java +++ b/server/src/main/java/com/vaadin/ui/declarative/Design.java @@ -454,7 +454,7 @@ public class Design implements Serializable { "The first level of a component hierarchy should contain at most one root component, but found " + children.size() + "."); } - Element element = children.size() == 0 ? null : children.first(); + Element element = children.isEmpty() ? null : children.first(); if (componentRoot != null) { if (element == null) { throw new DesignException( -- 2.39.5