Browse Source

Remove unneeded ArrayList construction

tags/8.2.0.alpha2
Ahmed Ashour 6 years ago
parent
commit
aa225cce86

+ 1
- 1
client/src/main/java/com/vaadin/client/ui/TouchScrollDelegate.java View File

@@ -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

+ 2
- 2
compatibility-server/src/main/java/com/vaadin/v7/ui/AbstractSelect.java View File

@@ -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);
}
}


+ 4
- 4
server/src/main/java/com/vaadin/data/BinderValidationStatus.java View File

@@ -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

+ 2
- 2
server/src/main/java/com/vaadin/data/ValidationException.java View File

@@ -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;
}

+ 1
- 1
server/src/main/java/com/vaadin/data/provider/HierarchyMapper.java View File

@@ -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));
}

+ 3
- 4
uitest/src/main/java/com/vaadin/tests/components/orderedlayout/BoxLayoutTest.java View File

@@ -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);

Loading…
Cancel
Save