summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmed Ashour <asashour@yahoo.com>2017-09-18 19:47:48 +0200
committerHenri Sara <henri.sara@gmail.com>2017-09-19 10:51:57 +0300
commitaa225cce86d34fc656e091f5eb62f73d17351345 (patch)
tree884500dd5f23086f0b51067ec1e9e7172375523f
parent797cc0104eaf291afbed913f1c748b1f76bbf522 (diff)
downloadvaadin-framework-aa225cce86d34fc656e091f5eb62f73d17351345.tar.gz
vaadin-framework-aa225cce86d34fc656e091f5eb62f73d17351345.zip
Remove unneeded ArrayList construction
-rw-r--r--client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java2
-rw-r--r--compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java4
-rw-r--r--server/src/main/java/com/vaadin/data/BinderValidationStatus.java8
-rw-r--r--server/src/main/java/com/vaadin/data/ValidationException.java4
-rw-r--r--server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java2
-rw-r--r--uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java7
6 files changed, 13 insertions, 14 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
index 7b22442474..e5eb99ad2d 100644
--- a/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
+++ b/client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java
@@ -711,7 +711,7 @@ public class TouchScrollDelegate implements NativePreviewHandler {
}
/**
- * long calcucation are not very efficient in GWT, so this helper method
+ * Long calculation are not very efficient in GWT, so this helper method
* returns timestamp in double.
*
* @return
diff --git a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java
index 2b27ea4eb4..a89818222c 100644
--- a/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java
+++ b/compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java
@@ -338,8 +338,8 @@ public abstract class AbstractSelect extends AbstractField<Object> implements
// Creates the options container and add given options to it
final Container c = new IndexedContainer();
if (options != null) {
- for (final Iterator<?> i = options.iterator(); i.hasNext();) {
- c.addItem(i.next());
+ for (final Object item : options) {
+ c.addItem(item);
}
}
diff --git a/server/src/main/java/com/vaadin/data/BinderValidationStatus.java b/server/src/main/java/com/vaadin/data/BinderValidationStatus.java
index c8d021ad53..90600f1800 100644
--- a/server/src/main/java/com/vaadin/data/BinderValidationStatus.java
+++ b/server/src/main/java/com/vaadin/data/BinderValidationStatus.java
@@ -137,10 +137,10 @@ public class BinderValidationStatus<BEAN> implements Serializable {
* @return a list of all validation errors
*/
public List<ValidationResult> getValidationErrors() {
- ArrayList<ValidationResult> errors = new ArrayList<>(
+ List<ValidationResult> errors =
getFieldValidationErrors().stream()
.map(s -> s.getResult().get())
- .collect(Collectors.toList()));
+ .collect(Collectors.toList());
errors.addAll(getBeanValidationErrors());
return errors;
}
@@ -148,7 +148,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
/**
* Gets the field level validation statuses.
* <p>
- * The field level validtors have been added with
+ * The field level validators have been added with
* {@link BindingBuilder#withValidator(Validator)}.
*
* @return the field validation statuses
@@ -169,7 +169,7 @@ public class BinderValidationStatus<BEAN> implements Serializable {
/**
* Gets the failed field level validation statuses.
* <p>
- * The field level validtors have been added with
+ * The field level validators have been added with
* {@link BindingBuilder#withValidator(Validator)}.
*
* @return a list of failed field level validation statuses
diff --git a/server/src/main/java/com/vaadin/data/ValidationException.java b/server/src/main/java/com/vaadin/data/ValidationException.java
index 6b3b0a121a..92043872e2 100644
--- a/server/src/main/java/com/vaadin/data/ValidationException.java
+++ b/server/src/main/java/com/vaadin/data/ValidationException.java
@@ -60,10 +60,10 @@ public class ValidationException extends Exception {
* @return a list of all validation errors
*/
public List<ValidationResult> getValidationErrors() {
- ArrayList<ValidationResult> errors = new ArrayList<>(
+ List<ValidationResult> errors =
getFieldValidationErrors().stream()
.map(s -> s.getResult().get())
- .collect(Collectors.toList()));
+ .collect(Collectors.toList());
errors.addAll(getBeanValidationErrors());
return errors;
}
diff --git a/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java b/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java
index 73343d8312..54914f2287 100644
--- a/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java
+++ b/server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java
@@ -96,7 +96,7 @@ public class HierarchyMapper<T, F> implements DataGenerator<T> {
*
*/
public Integer getParentIndex(T item) {
- // TODO: This can be optimised.
+ // TODO: This can be optimized.
List<T> flatHierarchy = getHierarchy(null).collect(Collectors.toList());
return flatHierarchy.indexOf(getParentOfItem(item));
}
diff --git a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
index b2f9b29bbf..f3cb05d158 100644
--- a/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
+++ b/uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java
@@ -2,6 +2,7 @@ package com.vaadin.tests.components.orderedlayout;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Theme;
@@ -166,8 +167,7 @@ public class BoxLayoutTest extends AbstractReindeerTestUI {
controls.addComponent(layout);
layout.addComponent(new Label("Layout"));
- ArrayList<String> sizes = new ArrayList<>();
- sizes.addAll(Arrays.asList("100px", "30em", "100%"));
+ List<String> sizes = Arrays.asList("100px", "30em", "100%");
final NativeSelect width = new NativeSelect(null, sizes);
width.setImmediate(true);
@@ -256,8 +256,7 @@ public class BoxLayoutTest extends AbstractReindeerTestUI {
root.addComponent(component);
component.addComponent(new Label("Component"));
- sizes = new ArrayList<>();
- sizes.addAll(Arrays.asList("50px", "200px", "10em", "50%", "100%"));
+ sizes = Arrays.asList("50px", "200px", "10em", "50%", "100%");
componentWidth = new NativeSelect(null, sizes);
componentWidth.setImmediate(true);