From 28b52d687dade66154a4fcd545415bf0d01b0a53 Mon Sep 17 00:00:00 2001 From: Ahmed Ashour Date: Tue, 3 Oct 2017 09:49:07 +0200 Subject: Remove unneeded .toArray() (#10131) Use for each loop. --- .../java/com/vaadin/v7/data/util/HierarchicalContainer.java | 3 +-- .../main/java/com/vaadin/v7/data/util/IndexedContainer.java | 1 - .../src/main/java/com/vaadin/v7/ui/Form.java | 12 +++++------- 3 files changed, 6 insertions(+), 10 deletions(-) (limited to 'compatibility-server/src') diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java index da6ff62b92..ad995fa20a 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/HierarchicalContainer.java @@ -593,8 +593,7 @@ public class HierarchicalContainer extends IndexedContainer public boolean removeItemRecursively(Object itemId) { disableContentsChangeEvents(); try { - boolean removeItemRecursively = removeItemRecursively(this, itemId); - return removeItemRecursively; + return removeItemRecursively(this, itemId); } finally { enableAndFireContentsChangeEvents(); } diff --git a/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java b/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java index 98f2deecac..fd1c768e9f 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/data/util/IndexedContainer.java @@ -550,7 +550,6 @@ public class IndexedContainer } } } - } @Override diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java index ea8fa1c528..747a0eea51 100644 --- a/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java +++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/Form.java @@ -657,11 +657,10 @@ public class Form extends AbstractField * (and only if) the return value is true. */ public boolean removeAllProperties() { - final Object[] properties = propertyIds.toArray(); boolean success = true; - for (int i = 0; i < properties.length; i++) { - if (!removeItemProperty(properties[i])) { + for (Object property : propertyIds.toArray()) { + if (!removeItemProperty(property)) { success = false; } } @@ -809,13 +808,12 @@ public class Form extends AbstractField // Move fields from previous layout if (getLayout() != null) { - final Object[] properties = propertyIds.toArray(); - for (int i = 0; i < properties.length; i++) { - Field f = getField(properties[i]); + for (Object property : propertyIds) { + Field f = getField(property); detachField(f); if (layout instanceof CustomLayout) { ((CustomLayout) layout).addComponent(f, - properties[i].toString()); + property.toString()); } else { layout.addComponent(f); } -- cgit v1.2.3